phpdoc-parser/doc/grammars/const-expr.peg

50 lines
865 B
Plaintext
Raw Normal View History

2017-11-12 23:21:58 +01:00
ConstantExpr
= ConstantFloat
/ ConstantInt
/ ConstantTrue
/ ConstantFalse
/ ConstantNull
/ ConstantString
/ ConstantArray
/ ConstantFetch
ConstantFloat
2017-11-17 10:12:33 +01:00
= '-'? [0-9]+ '.' [0-9]* ConstantFloatExp?
/ '-'? [0-9]* '.' [0-9]+ ConstantFloatExp?
/ '-'? [0-9]+ ConstantFloatExp
2017-11-12 23:21:58 +01:00
ConstantFloatExp
2017-11-17 10:12:33 +01:00
= [eE] '-'? [0-9]+
2017-11-12 23:21:58 +01:00
ConstantInt
2017-11-17 10:12:33 +01:00
= '-'? [0-9]+
2017-11-12 23:21:58 +01:00
ConstantTrue
= [tT][rR][uU][eE]
ConstantFalse
= [fF][aA][lL][sS][eE]
ConstantNull
= [nN][uU][lL][lL]
ConstantString
= '\'' ( [^'\\] / '\\' . )* '\''
/ '"' ( [^"\\] / '\\' . )* '"'
ConstantArray
= '[' ConstantArrayItems? ']'
/ 'array(' ConstantArrayItems? ')'
ConstantArrayItems
= ConstantArrayItem (',' ConstantArrayItem)* ','?
ConstantArrayItem
= ConstantExpr ('=>' ConstantExpr)?
ConstantFetch
= Identifier '::' Word
/ Identifier
# TODO: ConstantOperation, i.e. ˙2 + 3˙