Created
August 4, 2012 18:13
-
-
Save egonelbre/3259101 to your computer and use it in GitHub Desktop.
terenary operator
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
// testing place | |
http://egonelbre.com/js/bigram/ | |
// test input | |
a = c ? t + 4 : f + 3 ? a : b | |
// replace the tokens on the right side with these: | |
// version: C ?( T ): F | |
tokens = { | |
"=" : [7], | |
"?" : [6.5, next], ":" : [6.5, "<"], | |
"==" : [6], | |
"+" : [5], "-" : [5], | |
"*" : [4], "/" : [4], | |
"!" : [1, prefix], "~" : [1, prefix], | |
"^" : [1], | |
" " : [-1], | |
"(" : [0, next], ")" : [0, "<"] | |
}; | |
// version C ? ( T : F ) | |
tokens = { | |
"=" : [7], | |
"?" : [6.5], ":" : [6.5], | |
"==" : [6], | |
"+" : [5], "-" : [5], | |
"*" : [4], "/" : [4], | |
"!" : [1, prefix], "~" : [1, prefix], | |
"^" : [1], | |
" " : [-1], | |
"(" : [0, next], ")" : [0, "<"] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment