JohnNilsson / awk-sublime

Awk syntax highlighting in Sublime Text
MIT License
25 stars 6 forks source link

"/" is not treated like arithmetic operator #3

Closed zitryss closed 10 years ago

zitryss commented 11 years ago
#!/usr/bin/env awk

BEGIN {
    var1 = -18
    var2 = 7
}

{
    print "This line is normally highlighted"
    print "var1 / var2 =", var1 / var2
    print "This line shouldn't be white"
}

screen_shot_2013_09_19_at_02_14_29

JohnNilsson commented 10 years ago

Ah, a tricky one: http://pubs.opengroup.org/onlinepubs/7908799/xcu/awk.html

"There is a lexical ambiguity between the token ERE and the tokens "/" and DIV_ASSIGN. When an input sequence begins with a slash character in any syntactic context where the token "/" or DIV_ASSIGN could appear as the next token in a valid program, the longer of those two tokens that can be recognised will be recognised. In any other syntactic context where the token ERE could appear as the next token in a valid program, the token ERE will be recognised."