BNF for SRCPParser.jj

TOKENS

// The Tokenizer specification begins here:
/*
MORE :
{
  
}*/

//
//TOKEN:
//{
//    < JULDATE: (["0"-"9"])+ >
//  | < MINSEC: ["0"-"5"]["0"-"9"]>
//  | < HOUR: (["0"-"2"])?["0"-"9"]>
//}

//
<DEFAULT,IN_TIME> TOKEN : {
<EOL: "\n"> : DEFAULT
}

   
<DEFAULT> SKIP : {
<RETURN: "\r">
| <CONTINUE: "\\\n">
| <TAB: "\t">
| <SPACE: " ">
}

   
<DEFAULT> TOKEN : {
<ZEROADDR: "0" (["0"-"9"])*>
| <NONZEROADDR: ["1"-"9"] (["0"-"9"])*>
| <JMRITURNOUT: ["a"-"z","A"-"Z"] "T" (["0"-"9"])+>
| <JMRISENSOR: ["a"-"z","A"-"Z"] "S" (["0"-"9"])+>
| <JMRILIGHT: ["a"-"z","A"-"Z"] "L" (["0"-"9"])+>
| <ONOFF: <ON> | <OFF>>
| <#ON: <O> <N>>
| <#OFF: <O> (<F>){2}>
| <PROTOCOL: <A> | <F> | <L> | <P> | <S> | <N> | <M> | <Z>>
| <DRIVEMODE: "=" | "0" | "1" | "2">
| <FUNCTIONMODE: "=" | "0" | "1">
| <DELAY: ("-")? (["0"-"9"])+>
| <NMRA: <N> <M> <R> <A>>
| <FB: <F> <B>>
| <GA: <G> <A>>
| <GL: <G> <L>>
| <GM: <G> <M>>
| <SM: <S> <M>>
| <LOCK: <L> <O> <C> <K>>
| <TIME: <T> <I> <M> <E>>
| <POWER: <P> <O> <W> <E> <R>>
| <SESSION: <S> <E> <S> <S> <I> <O> <N>>
| <DESCRIPTION: <D> <E> <S> <C> <R> <I> <P> <T> <I> <O> <N>>
| <SERVER: <S> <E> <R> <V> <E> <R>>
| <SRCP: <S> <R> <C> <P>>
| <GO: <G> <O>>
| <VERSION: (["0"-"9"])+ "." (["0"-"9"])+ "." (["0"-"9"])+>
| <PROTOCOLLITTERAL: <P> <R> <O> <T> <O> <C> <O> <L>>
| <CONNECTIONMODELITTERAL: <C> <O> <N> <N> <E> <C> <T> <I> <O> <N> <M> <O> <D> <E>>
| <INFO: <I> <N> <F> <O>>
| <COMMAND: <C> <O> <M> <M> <A> <N> <D>>
| <CVBIT: <C> <V> <B> <I> <T>>
| <CV: <C> <V>>
| <REG: <R> <E> <G>>
| <GET: <G> <E> <T>>
| <SET: <S> <E> <T>>
| <CHECK: <C> <H> <E> <C> <K>>
| <INIT: <I> <N> <I> <T>>
| <TERM: <T> <E> <R> <M>>
| <WAIT: <W> <A> <I> <T>>
| <VERIFY: <V> <E> <R> <I> <F> <Y>>
| <RESET: <R> <E> <S> <E> <T>>
| <#A: ["a","A"]>
| <#B: ["b","B"]>
| <#C: ["c","C"]>
| <#D: ["d","D"]>
| <#E: ["e","E"]>
| <#F: ["f","F"]>
| <#G: ["g","G"]>
| <#H: ["h","H"]>
| <#I: ["i","I"]>
| <#J: ["j","J"]>
| <#K: ["k","K"]>
| <#L: ["l","L"]>
| <#M: ["m","M"]>
| <#N: ["n","N"]>
| <#O: ["o","O"]>
| <#P: ["p","P"]>
| <#Q: ["q","Q"]>
| <#R: ["r","R"]>
| <#S: ["s","S"]>
| <#T: ["t","T"]>
| <#U: ["u","U"]>
| <#V: ["v","V"]>
| <#W: ["w","W"]>
| <#X: ["x","X"]>
| <#Y: ["y","Y"]>
| <#Z: ["z","Z"]>
}

   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

NON-TERMINALS

// Lexical specifications begin here
handshakecommand ::= ( go | handshake_set ) <EOL>
command ::= ( get | set | check | wait_cmd | init | term | reset | verify ) <EOL>
serviceversion ::= ( <SRCP> ( <VERSION> ) )
connectionmode ::= ( <COMMAND> | <INFO> )
bus ::= ( zeroaddress | nonzeroaddress )
address ::= ( zeroaddress | nonzeroaddress )
value ::= ( zeroaddress | nonzeroaddress )
cvno ::= ( nonzeroaddress )
zeroaddress ::= <ZEROADDR>
nonzeroaddress ::= <NONZEROADDR>
port ::= ( zeroaddress | nonzeroaddress )
devicegroup ::= ( <FB> | <GA> | <GL> | <SM> | <TIME> | <SESSION> | <SERVER> | <LOCK> | <DESCRIPTION> | <POWER> )
go ::= <GO>
get ::= <GET> bus ( fb address | ga address port | gl address | sm address progmode cvno ( value )* | time | power | server | session address | lock | description )
handshake_set ::= <SET> ( protocollitteral serviceversion | connectionlitteral <SRCP> connectionmode )
protocollitteral ::= <PROTOCOLLITTERAL>
connectionlitteral ::= <CONNECTIONMODELITTERAL>
set ::= <SET> ( bus ( gl address drivemode address address ( functionmode )* | sm address progmode cvno ( value )+ | ga address port zeroone ( delay | timeout ) | fb address zeroone | time address address address address | power onoff | lock ) )
term ::= <TERM> bus ( fb | gl address | sm | power | server | lock | time | session ( address )? )
check ::= <CHECK> ( ( bus ( gl | sm | ga address port zeroone ( delay | timeout ) | fb address zeroone | time | power onoff | lock ) ) | <PROTOCOLLITTERAL> serviceversion | <CONNECTIONMODELITTERAL> connectionmode )
wait_cmd ::= <WAIT> bus ( fb address zeroone timeout | time address address address address )
init ::= <INIT> bus ( fb | ga address protocol | gl address protocol | sm <NMRA> | time nonzeroaddress nonzeroaddress | power )
reset ::= <RESET> bus server
verify ::= <VERIFY> bus sm address progmode cvno ( value )+
gl ::= <GL>
sm ::= <SM>
ga ::= <GA>
fb ::= <FB>
time ::= <TIME>
power ::= <POWER>
server ::= <SERVER>
session ::= <SESSION>
lock ::= ( <LOCK> devicegroup address ( address )? )
description ::= ( <DESCRIPTION> ( devicegroup ( address )? )? )
onoff ::= <ONOFF>
zeroone ::= ( zeroaddress | nonzeroaddress )
delay ::= <DELAY>
timeout ::= address
// service mode programming modes
progmode ::= ( cvbit | cv | reg )
cv ::= <CV>
cvbit ::= <CVBIT>
reg ::= <REG>
protocol ::= <PROTOCOL> ( address )*
drivemode ::= ( <DRIVEMODE> | <ZEROADDR> | <NONZEROADDR> )
functionmode ::= ( <FUNCTIONMODE> | <ZEROADDR> | <NONZEROADDR> | <DRIVEMODE> )