-
-
Save alapini/78b15cb890042186099d10bedbf46851 to your computer and use it in GitHub Desktop.
Xtext grammar for JSON documents
This file contains 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 characters
grammar org.json.Json with org.eclipse.xtext.common.Terminals | |
generate json "http://www.json.org/" | |
Object: | |
'{' ((members+=Member) (',' members+=Member)*)? '}'; | |
Member: | |
key=STRING ':' value=Value; | |
Value: | |
Object | STRING | Array | Boolean | Null | Number; | |
Array: | |
'[' ((values+=Value) (',' values+=Value)*)? ']'; | |
Boolean: | |
'true' | 'false'; | |
Null: | |
'null'; | |
terminal Number: | |
'-'? INT? ('.' INT (('E'|'e') '-'? INT)?)?; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment