more useful parse errors
This commit is contained in:
30
parse.cm
30
parse.cm
@@ -1196,6 +1196,36 @@ var parse = function(tokens, src, filename, tokenizer) {
|
||||
}
|
||||
|
||||
if (k == "name") {
|
||||
if (tok.value == "try" || tok.value == "catch" || tok.value == "finally") {
|
||||
parse_error(start, "'" + tok.value + "' is not supported; use disrupt/disruption instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
if (tok.value == "throw") {
|
||||
parse_error(start, "'throw' is not supported; use disrupt instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
if (tok.value == "class") {
|
||||
parse_error(start, "'class' is not supported; use meme()/proto() instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
if (tok.value == "new") {
|
||||
parse_error(start, "'new' is not supported; use meme()/proto() instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
if (tok.value == "switch" || tok.value == "case") {
|
||||
parse_error(start, "'" + tok.value + "' is not supported; use if/else instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
if (tok.value == "let" || tok.value == "const") {
|
||||
parse_error(start, "'" + tok.value + "' is not supported; use var/def instead")
|
||||
sync_to_statement()
|
||||
return null
|
||||
}
|
||||
p1_tok = peek_ahead(1)
|
||||
if (p1_tok.kind == ":") {
|
||||
node = ast_node("label", start)
|
||||
|
||||
BIN
parse.mach
BIN
parse.mach
Binary file not shown.
Reference in New Issue
Block a user