Source

DicomEdit / src / main / antlr3 / org / nrg / dcm / edit / EditDCMLexer.g

lexer grammar EditDCMLexer;

@header {
	package org.nrg.dcm.edit;
}

LEFT	:	'[';
RIGHT	:	']';
COMMA	:	',';

CONSTRAINS :	':';
DELETE	:	'-';
EQUALS	:	'=';
MATCHES	:	'~';
ASSIGN	:	':=';

ECHO	:	'echo';
NEW	:	'new';
DESCRIBE:	'describe';
HIDDEN	:	'hidden';
EXPORT  :	'export';


/* predefined identifiers:
 * UID (with new)
 * study index TBD
 * substring (as function)
 */
ID  :	('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
    ;

COMMENT
    :   '//' ~('\n'|'\r')*
    ;

WS  :   ( ' '
        | '\t'
        | ('\\' '\r'? '\n')
        ) {$channel=HIDDEN;}
    ;
    
NEWLINE	:	'\r'? '\n';



STRING
    :  '"' ( ESC_SEQ | ~('\\'|'"') )* '"'
    ;

NUMBER	:	'0' | ('-'? '1'..'9' DIGIT*);

TAG	:	LPAREN HEXWORD COMMA HEXWORD RPAREN;

TAGPATTERN
	:	LPAREN HEXPATWORD COMMA HEXPATWORD RPAREN;

fragment LPAREN	:	'(';

fragment RPAREN	:	')';

fragment DIGIT	:	('0'..'9');

fragment HEXWORD
	:	HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT;

fragment HEXDIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;

fragment HEXPATWORD
	:	HEXPATTERN HEXPATTERN HEXPATTERN HEXPATTERN;
	
fragment HEXPATTERN 
	:	'X' | '@' | '#' | HEXDIGIT;


fragment
ESC_SEQ
    :   '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
    |   UNICODE_ESC
    |   OCTAL_ESC
    ;

fragment
OCTAL_ESC
    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
    |   '\\' ('0'..'7') ('0'..'7')
    |   '\\' ('0'..'7')
    ;

fragment
UNICODE_ESC
    :   '\\' 'u' HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT
    ;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.