Skip to content

Commit

Permalink
[amd] [parse] refs brython-dev#188 - Match affixed STRING rule (rathe…
Browse files Browse the repository at this point in the history
…r than NAME). Fix auto-DEDENT position after blank lines ... ok
  • Loading branch information
olemis committed Feb 15, 2016
1 parent 2296f18 commit abbce96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions www/src/amd/brython/tkn.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

get_logline_re: function() {
// FIXME: Identifiers with Unicode chars
var re_id = '[a-zA-Z_]\\w*',
var re_id = '(?!(?:[uU]|[bB][rR]?|[rR][bB]?)?[\'"])[a-zA-Z_]\\w*',
re_ops = '(?:(?:(?:(?://|[*][*]|<<|>>)|[@=+\\-*/%&|^<>])=?)|[\\[\\](){},:;~]|[!]=|->|(?:[.](?:[.][.])?))',
re_number = '(?:0(?:0*|[oO][0-7]+|[xX][0-9a-fA-F]+|[bB][01]+)'+
'|(?:[1-9]\\d*[.]?|(?:[1-9]\\d*)?[.]\d+)(?:[eE]?[+-]?\\d+)?)',
Expand Down Expand Up @@ -248,9 +248,10 @@
null, 'EOF missmatch');
}
else {
if (!this._isblank)
if (!this._isblank) {
yield this.newline(t, '\n')
++this._row; this._col = 0;
++this._row; this._col = 0;
}
while (this._indents.pop() > 0)
yield this.text_token(PyLex.token_types.DEDENT, null, '', t);
yield this.text_token(PyLex.token_types.ENDMARKER, null, '', t);
Expand Down
3 changes: 2 additions & 1 deletion www/tests/amd/brython_tests/tkn.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
" if x:",
" return 3",
"",
"",
""
].join('\n'),
[
Expand Down Expand Up @@ -157,7 +158,7 @@
"15,20-15,21: NEWLINE '\\n'",
"16,4-16,5: NAME 'b'",
"16,6-16,7: OP '='",
"16,8-17,20: STRING 'b\\'\\'\\'wqdewoefoi\\2\\n wqe34rfy6\\'\\'\\''",
"16,8-17,20: STRING 'b\\'\\'\\'wqdewoefoi\\\\2\\n wqe34rfy6\\'\\'\\''",
"17,20-17,21: NEWLINE '\\n'",
"18,4-18,6: NAME 'if'",
"18,7-18,8: NAME 'x'",
Expand Down

0 comments on commit abbce96

Please sign in to comment.