Last active
December 14, 2015 01:59
-
-
Save mythagel/5010830 to your computer and use it in GitHub Desktop.
CMake ABNF grammar
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
; CMake list file grammar | |
newline = CR / LF / CRLF | |
whitespace = SP / HTAB / newline | |
comment = "#" *CHAR newline | |
wspc = whitespace / comment | |
identifier = ( ALPHA / "_" ) 1*( ALPHA / DIGIT / "_" ) | |
escape-char = "\\" ( "\\" / DQUOTE / SP / "#" / "(" / ")" / "$" / "@" / "^" / ";" / "t" / "n" / "r" / "0" ) | |
string-char = <CHAR excluding '"' and '\'> | |
quoted-argument = DQUOTE *(string-char / escape-char) DQUOTE | |
variable = "$" "(" *( ALPHA / DIGIT / "_" ) ")" | |
unquoted-argument' = (variable / <CHAR excluding SP HTAB CR LF "(" ")" "#" "\\" DQUOTE> / escape-char ) | |
*(variable / <CHAR excluding SP HTAB CR LF "(" ")" "#" "\\" DQUOTE> / escape-char / | |
DQUOTE *( variable / <CHAR excluding CR LF "(" ")" "#" "\\" DQUOTE> / escape-char ) DQUOTE) | |
unquoted-argument = unquoted-argument' / identifier | |
bracketed-argument = "(" *wspc *argument ")" | |
argument = (bracketed-argument / unquoted-argument / quoted-argument) *wspc | |
function = identifier *wspc "(" *wspc *argument ")" ( *(SP / HTAB) (newline / <EOF>)) | |
; Experimental CMake argument grammar | |
Start = (String cal_BSLASH) / String | |
String = Variable / OuterText | |
name = 1*(ALPHA / DIGIT / "/" / "_" / "." / "+" / "-") | |
symbol = 1*<CHAR excluding "$" "{" "}" "\\" "@"> | |
OuterText = cal_name / "@" / "$" / "{" / "}" / symbol | |
env-curly = "$" "E" "N" "V" "{" EnvVarName "}" | |
ncurly = "$" name "{" MultipleIds "}" | |
dcurly = "$" "{" MultipleIds "}" | |
atname = "@" name "@" | |
Variable = env-curly / ncurly / dcurly / atname | |
EnvVarName = MultipleIds / (symbol EnvVarName) | |
MultipleIds = *(name / Variable) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment