Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
add coffeescript-style multi-line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Apr 6, 2016
1 parent 0b60de8 commit e8348a6
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 103 deletions.
194 changes: 100 additions & 94 deletions skewc.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/frontend/flex.l
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

\n[ \t\r\n]* NEWLINE;
[ \t\r]+ WHITESPACE;
###\n([^#]|#[^#]|##[^#])*###.*\n? COMMENT_MULTILINE;
#.*\n? COMMENT;
\/\/.*\n? COMMENT_ERROR;

Expand Down
15 changes: 8 additions & 7 deletions src/frontend/lexer.sk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace Skew {
COMMA
COMMENT
COMMENT_ERROR
COMMENT_MULTILINE
COMPARE
CONST
CONTINUE
Expand Down Expand Up @@ -116,13 +117,13 @@ namespace Skew {
YY_INVALID_ACTION
}

const yy_accept List<TokenKind> = [.YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .END_OF_FILE, .ERROR, .WHITESPACE, .NEWLINE, .NOT, .ERROR, .COMMENT, .REMAINDER, .BITWISE_AND, .ERROR, .LEFT_PARENTHESIS, .RIGHT_PARENTHESIS, .MULTIPLY, .PLUS, .COMMA, .MINUS, .DOT, .DIVIDE, .INT, .INT, .COLON, .SEMICOLON, .LESS_THAN, .ASSIGN, .GREATER_THAN, .QUESTION_MARK, .ERROR, .IDENTIFIER, .LEFT_BRACKET, .RIGHT_BRACKET, .BITWISE_XOR, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .LEFT_BRACE, .BITWISE_OR, .RIGHT_BRACE, .TILDE, .WHITESPACE, .NEWLINE, .NOT_EQUAL, .YY_INVALID_ACTION, .STRING, .YY_INVALID_ACTION, .COMMENT, .COMMENT, .MODULUS, .ASSIGN_REMAINDER, .LOGICAL_AND, .ASSIGN_BITWISE_AND, .YY_INVALID_ACTION, .CHARACTER, .YY_INVALID_ACTION, .POWER, .ASSIGN_MULTIPLY, .INCREMENT, .ASSIGN_PLUS, .DECREMENT, .ASSIGN_MINUS, .DOT_DOT, .COMMENT_ERROR, .ASSIGN_DIVIDE, .XML_END_EMPTY, .YY_INVALID_ACTION, .INT, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .DOUBLE_COLON, .XML_START_CLOSE, .SHIFT_LEFT, .LESS_THAN_OR_EQUAL, .YY_INVALID_ACTION, .EQUAL, .ARROW, .GREATER_THAN_OR_EQUAL, .SHIFT_RIGHT, .NULL_DOT, .ASSIGN_NULL, .NULL_JOIN, .ANNOTATION, .IDENTIFIER, .YY_INVALID_ACTION, .INDEX, .YY_INVALID_ACTION, .ASSIGN_BITWISE_XOR, .AS, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IF, .IN, .IS, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .ASSIGN_BITWISE_OR, .LOGICAL_OR, .NOT_EQUAL_ERROR, .ASSIGN_MODULUS, .ASSIGN_POWER, .COMMENT_ERROR, .COMMENT_ERROR, .DOUBLE, .YY_INVALID_ACTION, .DOUBLE, .INT_BINARY, .INT_OCTAL, .INT_HEX, .ASSIGN_SHIFT_LEFT, .COMPARE, .YY_INVALID_ACTION, .EQUAL_ERROR, .ASSIGN_SHIFT_RIGHT, .UNSIGNED_SHIFT_RIGHT, .ANNOTATION, .YY_INVALID_ACTION, .ASSIGN_INDEX, .YY_INVALID_ACTION, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .FOR, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .TRY, .VAR, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .ASSIGN_UNSIGNED_SHIFT_RIGHT, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .IDENTIFIER, .CASE, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .ELSE, .IDENTIFIER, .IDENTIFIER, .NULL, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .TRUE, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .DOUBLE, .YY_INVALID_ACTION, .LIST, .LIST_NEW, .BREAK, .CATCH, .CONST, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .FALSE, .IDENTIFIER, .IDENTIFIER, .SUPER, .IDENTIFIER, .THROW, .WHILE, .SET, .SET_NEW, .YY_INVALID_ACTION, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .RETURN, .SWITCH, .YY_INVALID_ACTION, .IDENTIFIER, .DEFAULT, .DYNAMIC, .FINALLY, .XML_CHILD, .CONTINUE, .YY_INVALID_ACTION]
const yy_accept List<TokenKind> = [.YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .END_OF_FILE, .ERROR, .WHITESPACE, .NEWLINE, .NOT, .ERROR, .COMMENT, .REMAINDER, .BITWISE_AND, .ERROR, .LEFT_PARENTHESIS, .RIGHT_PARENTHESIS, .MULTIPLY, .PLUS, .COMMA, .MINUS, .DOT, .DIVIDE, .INT, .INT, .COLON, .SEMICOLON, .LESS_THAN, .ASSIGN, .GREATER_THAN, .QUESTION_MARK, .ERROR, .IDENTIFIER, .LEFT_BRACKET, .RIGHT_BRACKET, .BITWISE_XOR, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .LEFT_BRACE, .BITWISE_OR, .RIGHT_BRACE, .TILDE, .WHITESPACE, .NEWLINE, .NOT_EQUAL, .YY_INVALID_ACTION, .STRING, .YY_INVALID_ACTION, .COMMENT, .COMMENT, .COMMENT, .MODULUS, .ASSIGN_REMAINDER, .LOGICAL_AND, .ASSIGN_BITWISE_AND, .YY_INVALID_ACTION, .CHARACTER, .YY_INVALID_ACTION, .POWER, .ASSIGN_MULTIPLY, .INCREMENT, .ASSIGN_PLUS, .DECREMENT, .ASSIGN_MINUS, .DOT_DOT, .COMMENT_ERROR, .ASSIGN_DIVIDE, .XML_END_EMPTY, .YY_INVALID_ACTION, .INT, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .DOUBLE_COLON, .XML_START_CLOSE, .SHIFT_LEFT, .LESS_THAN_OR_EQUAL, .YY_INVALID_ACTION, .EQUAL, .ARROW, .GREATER_THAN_OR_EQUAL, .SHIFT_RIGHT, .NULL_DOT, .ASSIGN_NULL, .NULL_JOIN, .ANNOTATION, .IDENTIFIER, .YY_INVALID_ACTION, .INDEX, .YY_INVALID_ACTION, .ASSIGN_BITWISE_XOR, .AS, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IF, .IN, .IS, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .ASSIGN_BITWISE_OR, .LOGICAL_OR, .NOT_EQUAL_ERROR, .COMMENT, .ASSIGN_MODULUS, .ASSIGN_POWER, .COMMENT_ERROR, .COMMENT_ERROR, .DOUBLE, .YY_INVALID_ACTION, .DOUBLE, .INT_BINARY, .INT_OCTAL, .INT_HEX, .ASSIGN_SHIFT_LEFT, .COMPARE, .YY_INVALID_ACTION, .EQUAL_ERROR, .ASSIGN_SHIFT_RIGHT, .UNSIGNED_SHIFT_RIGHT, .ANNOTATION, .YY_INVALID_ACTION, .ASSIGN_INDEX, .YY_INVALID_ACTION, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .FOR, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .TRY, .VAR, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .COMMENT, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .ASSIGN_UNSIGNED_SHIFT_RIGHT, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .IDENTIFIER, .CASE, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .ELSE, .IDENTIFIER, .IDENTIFIER, .NULL, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .TRUE, .IDENTIFIER, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .DOUBLE, .YY_INVALID_ACTION, .LIST, .LIST_NEW, .BREAK, .CATCH, .CONST, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .FALSE, .IDENTIFIER, .IDENTIFIER, .SUPER, .IDENTIFIER, .THROW, .WHILE, .SET, .SET_NEW, .YY_INVALID_ACTION, .YY_INVALID_ACTION, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .IDENTIFIER, .RETURN, .SWITCH, .COMMENT_MULTILINE, .YY_INVALID_ACTION, .IDENTIFIER, .DEFAULT, .DYNAMIC, .FINALLY, .COMMENT_MULTILINE, .COMMENT_MULTILINE, .XML_CHILD, .CONTINUE, .YY_INVALID_ACTION]
const yy_ec = [0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 30, 29, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 34, 35, 31, 1, 36, 37, 38, 39, 40, 41, 31, 42, 43, 31, 44, 45, 46, 47, 48, 49, 31, 50, 51, 52, 53, 54, 55, 56, 57, 31, 58, 59, 60, 61, 1]
const yy_meta = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1]
const yy_base = [0, 0, 0, 324, 325, 321, 60, 297, 59, 318, 58, 59, 57, 325, 325, 56, 57, 325, 54, 304, 60, 77, 83, 297, 325, 63, 46, 48, 84, 0, 0, 90, 325, 293, 266, 266, 72, 65, 270, 83, 87, 261, 273, 23, 68, 276, 269, 96, 90, 325, 325, 308, 127, 284, 111, 325, 305, 304, 325, 281, 325, 325, 325, 112, 325, 302, 279, 325, 325, 325, 325, 325, 325, 300, 325, 325, 121, 132, 145, 117, 136, 0, 325, 325, 277, 275, 284, 274, 325, 325, 121, 325, 325, 325, 0, 0, 282, 272, 256, 325, 0, 255, 116, 247, 252, 245, 240, 245, 242, 238, 0, 0, 0, 242, 234, 236, 241, 233, 104, 232, 238, 264, 239, 325, 325, 325, 325, 325, 275, 325, 155, 159, 163, 151, 168, 0, 325, 325, 261, 325, 325, 251, 0, 259, 325, 219, 237, 232, 233, 138, 234, 233, 228, 216, 230, 0, 220, 211, 223, 210, 213, 220, 0, 0, 214, 242, 202, 178, 240, 325, 221, 220, 209, 0, 210, 199, 207, 196, 202, 0, 207, 201, 0, 195, 194, 205, 187, 0, 201, 180, 179, 182, 186, 214, 325, 325, 0, 0, 0, 190, 191, 192, 0, 189, 147, 0, 150, 0, 0, 325, 325, 154, 106, 80, 89, 37, 0, 0, 65, 35, 0, 0, 0, 325, 0, 325, 207, 211, 215, 217, 220, 224, 227, 229]
const yy_def = [0, 225, 1, 225, 225, 225, 225, 225, 226, 227, 225, 225, 228, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 229, 230, 225, 225, 225, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, 225, 225, 225, 226, 225, 226, 227, 225, 225, 225, 225, 225, 228, 225, 228, 225, 225, 225, 225, 225, 225, 225, 231, 225, 225, 225, 225, 225, 225, 225, 232, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 233, 230, 225, 225, 225, 225, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, 225, 225, 225, 231, 225, 225, 225, 225, 225, 225, 232, 225, 225, 225, 225, 225, 225, 233, 225, 225, 225, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, 225, 225, 225, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 225, 225, 225, 225, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 225, 225, 225, 230, 230, 230, 230, 230, 230, 225, 230, 230, 230, 230, 225, 230, 0, 225, 225, 225, 225, 225, 225, 225, 225]
const yy_nxt = [0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 30, 31, 4, 32, 33, 34, 35, 36, 37, 38, 39, 30, 40, 30, 30, 30, 41, 30, 30, 42, 43, 44, 30, 45, 46, 30, 30, 47, 48, 49, 50, 52, 52, 55, 59, 64, 61, 66, 70, 68, 87, 88, 89, 90, 224, 115, 73, 116, 71, 83, 67, 69, 60, 62, 74, 75, 84, 85, 86, 65, 223, 56, 76, 222, 77, 77, 77, 77, 76, 91, 77, 77, 77, 77, 104, 96, 78, 102, 92, 117, 93, 121, 78, 79, 123, 55, 78, 118, 107, 103, 64, 105, 78, 97, 80, 108, 221, 110, 52, 52, 109, 220, 81, 111, 133, 133, 98, 112, 130, 130, 130, 130, 122, 56, 65, 140, 141, 76, 124, 77, 77, 77, 77, 134, 134, 134, 161, 131, 219, 131, 162, 78, 132, 132, 132, 132, 147, 148, 133, 133, 218, 78, 130, 130, 130, 130, 132, 132, 132, 132, 132, 132, 132, 132, 167, 134, 134, 134, 175, 176, 191, 217, 191, 216, 167, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 54, 54, 54, 54, 57, 57, 57, 57, 63, 63, 63, 63, 94, 94, 95, 95, 95, 128, 128, 128, 128, 135, 135, 142, 142, 142, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 174, 173, 172, 171, 170, 169, 168, 129, 166, 165, 164, 163, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 146, 145, 144, 143, 139, 138, 137, 136, 129, 127, 225, 126, 58, 225, 125, 51, 120, 119, 114, 113, 106, 101, 100, 99, 82, 72, 58, 53, 51, 225, 3, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225]
const yy_chk = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 8, 10, 12, 11, 15, 18, 16, 26, 26, 27, 27, 219, 43, 20, 43, 18, 25, 15, 16, 10, 11, 20, 20, 25, 25, 25, 12, 218, 8, 21, 215, 21, 21, 21, 21, 22, 28, 22, 22, 22, 22, 37, 31, 21, 36, 28, 44, 28, 47, 22, 21, 48, 54, 21, 44, 39, 36, 63, 37, 22, 31, 21, 39, 214, 40, 52, 52, 39, 213, 21, 40, 79, 79, 31, 40, 76, 76, 76, 76, 47, 54, 63, 90, 90, 77, 48, 77, 77, 77, 77, 80, 80, 80, 118, 78, 212, 78, 118, 77, 78, 78, 78, 78, 102, 102, 133, 133, 211, 77, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 130, 134, 134, 134, 149, 149, 167, 206, 167, 204, 130, 167, 167, 167, 167, 191, 191, 191, 191, 192, 192, 192, 192, 226, 226, 226, 226, 227, 227, 227, 227, 228, 228, 228, 228, 229, 229, 230, 230, 230, 231, 231, 231, 231, 232, 232, 233, 233, 233, 203, 201, 200, 199, 193, 190, 189, 188, 186, 185, 184, 183, 181, 180, 178, 177, 176, 175, 174, 172, 171, 170, 168, 166, 165, 164, 161, 160, 159, 158, 157, 156, 154, 153, 152, 151, 150, 148, 147, 146, 145, 143, 141, 138, 128, 122, 121, 120, 119, 117, 116, 115, 114, 113, 109, 108, 107, 106, 105, 104, 103, 101, 98, 97, 96, 87, 86, 85, 84, 73, 66, 65, 59, 57, 56, 53, 51, 46, 45, 42, 41, 38, 35, 34, 33, 23, 19, 9, 7, 5, 3, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225]
const YY_JAM_STATE = 225
const YY_ACCEPT_LENGTH = 226
const yy_base = [0, 0, 0, 342, 343, 339, 60, 315, 59, 62, 59, 61, 58, 343, 343, 58, 60, 343, 56, 323, 62, 77, 83, 316, 343, 94, 49, 51, 99, 0, 0, 74, 343, 312, 285, 285, 46, 32, 289, 86, 59, 280, 292, 25, 85, 295, 288, 89, 84, 343, 343, 327, 128, 303, 107, 343, 324, 323, 343, 135, 300, 343, 343, 343, 119, 343, 321, 298, 343, 343, 343, 343, 343, 343, 319, 343, 343, 126, 135, 148, 130, 139, 0, 343, 343, 296, 294, 303, 293, 343, 343, 145, 343, 343, 343, 0, 0, 301, 291, 275, 343, 0, 274, 121, 266, 271, 264, 259, 264, 261, 257, 0, 0, 0, 261, 253, 255, 260, 252, 107, 251, 257, 283, 258, 343, 343, 343, 294, 343, 343, 293, 343, 158, 162, 166, 171, 173, 0, 343, 343, 279, 343, 343, 269, 0, 277, 343, 237, 255, 250, 251, 143, 252, 251, 246, 234, 248, 0, 238, 229, 241, 228, 231, 238, 0, 0, 232, 260, 220, 268, 184, 257, 343, 238, 237, 226, 0, 227, 216, 224, 213, 219, 0, 224, 218, 0, 212, 211, 222, 204, 0, 218, 197, 196, 249, 248, 188, 192, 229, 343, 343, 0, 0, 0, 205, 206, 207, 0, 204, 201, 0, 159, 0, 0, 343, 343, 194, 179, 121, 110, 112, 85, 0, 0, 136, 111, 92, 0, 0, 0, 113, 343, 343, 0, 343, 213, 217, 221, 223, 226, 230, 233, 235, 239, 243]
const yy_def = [0, 234, 1, 234, 234, 234, 234, 234, 235, 236, 234, 234, 237, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 238, 239, 234, 234, 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 234, 234, 234, 234, 234, 234, 234, 235, 234, 235, 236, 234, 236, 234, 234, 234, 234, 237, 234, 237, 234, 234, 234, 234, 234, 234, 234, 240, 234, 234, 234, 234, 234, 234, 234, 241, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 242, 239, 234, 234, 234, 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 234, 234, 234, 234, 234, 236, 234, 234, 240, 234, 234, 234, 234, 234, 234, 241, 234, 234, 234, 234, 234, 234, 242, 234, 234, 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 234, 234, 243, 234, 234, 234, 234, 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 234, 234, 243, 243, 234, 234, 234, 234, 234, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 234, 234, 243, 234, 239, 239, 239, 239, 239, 239, 244, 234, 239, 239, 239, 239, 244, 234, 234, 239, 0, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234]
const yy_nxt = [0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 30, 31, 4, 32, 33, 34, 35, 36, 37, 38, 39, 30, 40, 30, 30, 30, 41, 30, 30, 42, 43, 44, 30, 45, 46, 30, 30, 47, 48, 49, 50, 52, 52, 55, 58, 60, 65, 59, 62, 67, 71, 105, 69, 88, 89, 90, 91, 116, 74, 117, 72, 103, 68, 61, 70, 63, 75, 76, 106, 97, 66, 56, 77, 104, 78, 78, 78, 78, 77, 111, 78, 78, 78, 78, 122, 112, 79, 98, 124, 113, 84, 55, 79, 80, 92, 231, 79, 85, 86, 87, 99, 108, 79, 93, 81, 94, 118, 65, 109, 52, 52, 233, 82, 110, 119, 123, 232, 58, 231, 56, 127, 229, 125, 132, 132, 132, 132, 135, 135, 228, 77, 66, 78, 78, 78, 78, 136, 136, 136, 163, 133, 227, 133, 164, 79, 134, 134, 134, 134, 142, 143, 149, 150, 226, 79, 132, 132, 132, 132, 134, 134, 134, 134, 134, 134, 134, 134, 170, 135, 135, 136, 136, 136, 178, 179, 225, 196, 170, 196, 224, 223, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 54, 54, 54, 54, 57, 57, 57, 57, 64, 64, 64, 64, 95, 95, 96, 96, 96, 130, 130, 130, 130, 137, 137, 144, 144, 144, 194, 194, 194, 194, 230, 230, 230, 230, 222, 221, 220, 219, 218, 217, 216, 195, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 195, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 177, 176, 175, 174, 173, 172, 171, 131, 169, 168, 167, 166, 165, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 148, 147, 146, 145, 141, 140, 139, 138, 131, 129, 234, 128, 58, 234, 126, 51, 121, 120, 115, 114, 107, 102, 101, 100, 83, 73, 53, 51, 234, 3, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234]
const yy_chk = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 8, 9, 10, 12, 9, 11, 15, 18, 37, 16, 26, 26, 27, 27, 43, 20, 43, 18, 36, 15, 10, 16, 11, 20, 20, 37, 31, 12, 8, 21, 36, 21, 21, 21, 21, 22, 40, 22, 22, 22, 22, 47, 40, 21, 31, 48, 40, 25, 54, 22, 21, 28, 230, 21, 25, 25, 25, 31, 39, 22, 28, 21, 28, 44, 64, 39, 52, 52, 226, 21, 39, 44, 47, 225, 59, 224, 54, 59, 221, 48, 77, 77, 77, 77, 80, 80, 220, 78, 64, 78, 78, 78, 78, 81, 81, 81, 119, 79, 219, 79, 119, 78, 79, 79, 79, 79, 91, 91, 103, 103, 218, 78, 132, 132, 132, 132, 133, 133, 133, 133, 134, 134, 134, 134, 132, 135, 135, 136, 136, 136, 151, 151, 217, 170, 132, 170, 216, 211, 170, 170, 170, 170, 196, 196, 196, 196, 197, 197, 197, 197, 235, 235, 235, 235, 236, 236, 236, 236, 237, 237, 237, 237, 238, 238, 239, 239, 239, 240, 240, 240, 240, 241, 241, 242, 242, 242, 243, 243, 243, 243, 244, 244, 244, 244, 209, 208, 206, 205, 204, 198, 195, 194, 193, 192, 191, 189, 188, 187, 186, 184, 183, 181, 180, 179, 178, 177, 175, 174, 173, 171, 169, 168, 167, 166, 163, 162, 161, 160, 159, 158, 156, 155, 154, 153, 152, 150, 149, 148, 147, 145, 143, 140, 130, 127, 123, 122, 121, 120, 118, 117, 116, 115, 114, 110, 109, 108, 107, 106, 105, 104, 102, 99, 98, 97, 88, 87, 86, 85, 74, 67, 66, 60, 57, 56, 53, 51, 46, 45, 42, 41, 38, 35, 34, 33, 23, 19, 7, 5, 3, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234]
const YY_JAM_STATE = 234
const YY_ACCEPT_LENGTH = 235
}
7 changes: 5 additions & 2 deletions src/frontend/token.sk
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace Skew {
}

# Ignore whitespace
if yy_act == .WHITESPACE {
if yy_act == .WHITESPACE || yy_act == .COMMENT_MULTILINE {
continue
}

Expand Down Expand Up @@ -277,8 +277,11 @@ namespace Skew {
# - "var x = 0 \n .toString"
# - "var x = 0 # comment \n .toString"
# - "var x = 0 \n # comment \n .toString"
# - "var x = 0 \n ### \n multi-line comment \n ### \n return 0"
#
if (previousKind == .NEWLINE || previousKind == .COMMENT) && token.kind in REMOVE_WHITESPACE_BEFORE {
if previousKind == .NEWLINE && token.kind == .NEWLINE {
continue
} else if (previousKind == .NEWLINE || previousKind == .COMMENT) && token.kind in REMOVE_WHITESPACE_BEFORE {
while true {
tokens.removeLast
if tokens.isEmpty || tokens.last.kind != .NEWLINE && tokens.last.kind != .COMMENT {
Expand Down
Loading

0 comments on commit e8348a6

Please sign in to comment.