Last active
October 15, 2018 21:49
-
-
Save backupbrain/0c4b1cfbdb5fcaa4abb7d6ca717a845d to your computer and use it in GitHub Desktop.
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
function LexicalAnalyzer() { | |
this.tokenTypes = { | |
"include": /^include$/, | |
"string": /^\"[^\"]+\"$/, | |
"unaryop": /^(sin|cos|tan|exp|ln|sqrt)$/, | |
"exp": /^(\+|\-|\*|\/|\^)$/, | |
"comma": /^\,$/, | |
"openparen": /^\($/, | |
"closeparen": /^\)$/, | |
"openbracket": /^\[$/, | |
"closebracket": /^\]$/, | |
"openfunction": /^\{$/, | |
"closefunction": /^\}$/, | |
"uop": /^(U|CX)$/, | |
"qop": /^(measure|reset)$/, | |
"pointer": /^\-\>$/, | |
"gop": /^barrier$/, | |
"gatedecl": /gate/, | |
"decl": /^(qreg|creg)$/, | |
"control": /^if$/, | |
"condition": /^(\=\=|\!\=)$/, | |
"statement": /^(opaque)$/, | |
"mainprogram": /^OPENQASM$/, | |
"id": /^[a-z][A-Za-z0-9_]*$/, | |
"const": /^pi$/, | |
"eol": /^\;$/, | |
"id": /^[a-z][A-Za-z0-9_]*$/, | |
"real": /^([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?$/, | |
"nninteger": /^[1-9]+[0-9]*|0$/, | |
"var": /^[\a-zA-Z]+[a-zA-Z0-9\_]*$/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment