Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Issue 2732193007: Create a TokenStreamRewriter class. (Closed)

Created:
3 years, 9 months ago by Paul Berry
Modified:
3 years, 9 months ago
Reviewers:
ahe, danrubel
CC:
reviews_dartlang.org, dart-fe-team+reviews_google.com
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Create a TokenStreamRewriter class. This class will allow parser error recovery to insert synthetic tokens into the token stream. It makes use of Token.previousToken when it's available, but does not depend on it; when it's not available, it falls back on heuristics which should still be fast, and which don't impose any performance burden until the first synthetic token is inserted. R=danrubel@google.com Committed: https://github.com/dart-lang/sdk/commit/b505603f5f38f28c22effb1c0644731b4804311c

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+253 lines, -0 lines) Patch
A pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart View 1 chunk +104 lines, -0 lines 4 comments Download
A pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart View 1 chunk +149 lines, -0 lines 1 comment Download

Messages

Total messages: 7 (2 generated)
Paul Berry
3 years, 9 months ago (2017-03-08 17:37:27 UTC) #2
danrubel
LGTM
3 years, 9 months ago (2017-03-08 21:32:11 UTC) #3
Paul Berry
Committed patchset #1 (id:1) manually as b505603f5f38f28c22effb1c0644731b4804311c (presubmit successful).
3 years, 9 months ago (2017-03-08 21:40:36 UTC) #5
ahe
lgtm https://codereview.chromium.org/2732193007/diff/1/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart File pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart (right): https://codereview.chromium.org/2732193007/diff/1/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart#newcode47 pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart:47: // Note: even though previousToken is deprecated, we ...
3 years, 9 months ago (2017-03-09 13:47:08 UTC) #6
Paul Berry
3 years, 9 months ago (2017-03-09 16:44:39 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/2732193007/diff/1/pkg/front_end/lib/src/fasta...
File pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart (right):

https://codereview.chromium.org/2732193007/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart:47: // Note: even
though previousToken is deprecated, we need to hook it up in
On 2017/03/09 13:47:07, ahe wrote:
> A trick I've used in the past:
> 
> {
>   // Note: even though previousToken is deprecated, we need to hook it up in
>   // case any uses of it remain.  Once previousToken is removed it should be
>   // safe to remove this block of code.
>   insertionPoint.previousToken = newToken;
>   newToken.previousToken = previous;
> }

Good idea--that's much clearer.  I'll fix in a follow-up CL.

https://codereview.chromium.org/2732193007/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart:84: /// Uses
heuristics to skip matching {}, [], (), and <> if possible.
On 2017/03/09 13:47:08, ahe wrote:
> Wrap syntax in back ticks?

Will address in a follow-up CL.

Powered by Google App Engine
This is Rietveld 408576698