Created
August 10, 2021 14:59
-
-
Save newpolaris/02f1a164ce9e78f736b5e7a9a11bac5b to your computer and use it in GitHub Desktop.
Revisions
-
newpolaris created this gist
Aug 10, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,91 @@ grammar Material; @lexer::members { boolean ignoreNewLine = true; } material_list : material | material_list material ; material : MATERIAL material_name material_parent? LBRACE material_body RBRACE ; material_parent : COLON IDENTIFIER ; material_name : IDENTIFIER ; material_body : material_child | material_body material_child ; material_child : define_statement | technique_statement | sampler_define | uniform_define ; define_statement : DEFINES ASSIGNMENT definements SEMICOLON? ; definements : IDENTIFIER | definements SEMICOLON IDENTIFIER ; technique_statement : TECHNIQUE LBRACE RBRACE ; sampler_define : SAMPLER IDENTIFIER LBRACE RBRACE ; uniform_define : IDENTIFIER ASSIGNMENT uniform_value ; uniform_value : ; MATERIAL : 'material'; DEFINES : 'defines'; TECHNIQUE : 'technique'; SAMPLER : 'sampler'; ASSIGNMENT: '=' ; LPAREN: '(' ; RPAREN: ')' ; LBRACE: '{' ; RBRACE: '}' ; SEMICOLON: ';' ; LBRACKET: '[' ; RBRACKET: ']' ; COMMA: ',' ; COLON: ':' ; IDENTIFIER : ('a'..'z' | 'A'..'Z' | '_') (DIGIT | 'a'..'z' | 'A'..'Z' | '_')* ; fragment DECIMAL_DIGITS: '0' | ('1'..'9' DIGIT*); fragment OCTAL_DIGITS: '0' '0'..'7'+; fragment HEX_DIGITS: '0x' (DIGIT | 'a'..'f' | 'A'..'F')+; fragment DIGIT : '0'..'9'; WS: [\t\r\n\u000C ]+ -> skip; EOL: '\n' -> skip; COMMENT: ('//' ~('\n'|'\r')* '\r'? '\n' | '/*' (.)*? '*/') -> skip ;