Demo entry 6684467

aia

   

Submitted by anonymous on Dec 15, 2017 at 11:02
Language: ANTLR. Code size: 978 Bytes.

grammar AiaTerm;

@header {
package com.sogecap.framework.aia.datareader;

import java.util.regex.Pattern;
}
		

term
   : value
   ;

obj
   : '[' pair (',' pair)* ']'
   ;

pair
   : STRING '=' value
   | IDENTIFIER '=' value
   | IDENTIFIER '==' value
   ;

function
   : IDENTIFIER array
   ;

array
   : '[' value (',' value)* ']'
   | '(' value (',' value)* ')'
   | '[' ']'
   | '(' ')'
   ;

value
   : STRING
   | NUMBER
   | IDENTIFIER
   | obj
   | array
   | function
   | 'true'
   | 'false'
   | 'null'
   ;


STRING
   : '"' ('""' | ~ ["\r\n])* '"'
   ;
IDENTIFIER
   : (LETTERS_AND_MAYBE_DIGITS+)
   ;
fragment LETTERS_AND_MAYBE_DIGITS
   : ([0-9]*[a-zA-Z_$:]+[0-9]*)
   ;
NUMBER
   : '-'? INT ('.' [0-9] +)? EXP?
   ;
fragment INT
   : '0' | [1-9] [0-9]*
   ;
// no leading zeros
fragment EXP
   : [Ee] [+\-]? INT
   ;
// \- since - means "range" inside [...]
WS
   : [ \t\n\r] + -> skip
   ;

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).