Added "switch" and "case" to the list of keywords so they can't be used as variable names.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-04 06:40:09 +01:00
Ursprung 4753574bae
Commit 61b2ea4007

Datei anzeigen

@ -109,7 +109,7 @@ public class Lexer {
characterTokens.add(':'); characterTokens.add(':');
} }
private static final Set<String> keywords = new HashSet<String>(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return")); private static final Set<String> keywords = new HashSet<String>(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return", "switch", "case"));
private static final Pattern numberPattern = Pattern.compile("^([0-9]*(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)"); private static final Pattern numberPattern = Pattern.compile("^([0-9]*(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)");
private static final Pattern identifierPattern = Pattern.compile("^([A-Za-z][0-9A-Za-z_]*)"); private static final Pattern identifierPattern = Pattern.compile("^([A-Za-z][0-9A-Za-z_]*)");