marwan.akhandaf
v1.0.5
Published
my reactjs
Downloads
3
Readme
Grammar
keywords
var : 'var' let : 'let' const : 'const' function : 'function' return : 'return' import : 'import' from : 'from' as : 'as'
statement : block | variableStatement | functionDeclaration | returnStatement | importStatement ;
block : '{' statementList? '}' ;
statementList : statement+ ;
variableStatement
variableStatement : varModifier '=' variablepossible ;
varModifier : var | let | const ;
variablepossible : literal ;
string : [A-Za-z0-9]+ ;
onlyAlpha : [A-Za-z]+ ;
integer :[0-9]+ ;
boolean :'true' |'false' ;
htmlTagName : 'h1' : 'p' : 'strong' ;
functionDeclaration
functionDeclaration : function onlyAlpha '(' parameterList? ')' '{' functionBody '}' ;
parameterList : parameterArg (',' parameterArg)* ;
parameterArg : varModifier string ('=' variablepossible)? ;
functionBody :statementList? ;
returnStatement
returnStatement : return '(' htmlElements ')' | return variablepossible ;
htmlElements : htmlElement+ ;
htmlElement : '<' htmlTagName '>' htmlContent '<''/' htmlTagName '>' | '<' htmlTagName '/''>' | '<' htmlTagName '>' ;
nested html
htmlContent
: (string | htmlElement)+
;
importStatement
importStatement : import importFromBlock ;
importFromBlock : (importNamespace | moduleItems) importFrom ;
importNamespace : ('*' | onlyAlpha) (as onlyAlpha)? ;
moduleItems : '{' (onlyAlpha ',')* (onlyAlpha ','?)? '}' ;
importFrom : from '"'string'"' ;
nog doen
literals
literal : stringLiteral | numberLiteral | booleanLiteral ;
stringLiteral : ''' string ''' | '"' string '"' ;
numberLiteral : integer | float ;
booleanLiteral : 'true' | 'false' ;
pair
: stringLiteral ':' literal
;