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

Issue 9190038: Handle escapes in string literals. (Closed)

Created:
8 years, 11 months ago by Lasse Reichstein Nielsen
Modified:
8 years, 11 months ago
Reviewers:
ahe, floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Handle escapes in string literals. Also handles raw strings. Committed: https://code.google.com/p/dart/source/detail?r=3386

Patch Set 1 #

Total comments: 22

Patch Set 2 : Rewrote to use iterators on SourceString. #

Total comments: 6

Patch Set 3 : Added hadnling of scanner exceptions. #

Total comments: 2

Patch Set 4 : minor cleanup #

Patch Set 5 : Add dependency on characters.dart to mini_parser.dart. #

Total comments: 8

Patch Set 6 : Make scanner-bench work #

Patch Set 7 : Removed validation from scanner #

Unified diffs Side-by-side diffs Delta from patch set Stats (+353 lines, -133 lines) Patch
D frog/leg/scanner/characters.dart View 1 2 1 chunk +0 lines, -105 lines 0 comments Download
M frog/leg/scanner/parser.dart View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/scanner/scanner.dart View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download
M frog/leg/scanner/scanner_implementation.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M frog/leg/scanner/scanner_task.dart View 1 2 1 chunk +10 lines, -1 line 0 comments Download
M frog/leg/scanner/scannerlib.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/scanner/token.dart View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M frog/leg/scanner/vm_scanner_bench.dart View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/ssa/builder.dart View 1 5 1 chunk +0 lines, -3 lines 0 comments Download
M frog/leg/ssa/codegen.dart View 1 2 3 2 chunks +7 lines, -6 lines 0 comments Download
M frog/leg/ssa/nodes.dart View 1 2 3 4 5 6 3 chunks +158 lines, -3 lines 0 comments Download
M frog/leg/ssa/ssa.dart View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M frog/leg/tools/mini_parser.dart View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
A + frog/leg/util/characters.dart View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M frog/tests/leg/src/BuiltinInterceptorTest.dart View 1 2 3 4 5 6 1 chunk +6 lines, -12 lines 0 comments Download
M frog/tests/leg/src/ScannerTest.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download
A frog/tests/leg/src/StringEscapesTest.dart View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
A frog/tests/leg_only/src/StringEscapeTest.dart View 1 2 3 4 5 6 1 chunk +128 lines, -0 lines 0 comments Download
M tests/language/language-leg.status View 1 2 3 4 5 6 2 chunks +0 lines, -2 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Lasse Reichstein
Peter, please check the scanner changes.
8 years, 11 months ago (2012-01-12 11:20:39 UTC) #1
ahe
This makes the scanner slightly slower. Let's talk about alternatives face-to-face.
8 years, 11 months ago (2012-01-12 12:06:29 UTC) #2
floitsch
LGTM with many nits. If you disagree talk to me, to make sure it's not ...
8 years, 11 months ago (2012-01-12 12:30:28 UTC) #3
Lasse Reichstein Nielsen
Rewrite to use SourceString iterators. http://codereview.chromium.org/9190038/diff/1/frog/leg/ssa/nodes.dart File frog/leg/ssa/nodes.dart (right): http://codereview.chromium.org/9190038/diff/1/frog/leg/ssa/nodes.dart#newcode1559 frog/leg/ssa/nodes.dart:1559: return hexDigit - 0x30; ...
8 years, 11 months ago (2012-01-16 13:30:23 UTC) #4
floitsch
LGTM. consider moving the characters lib into another directory. http://codereview.chromium.org/9190038/diff/6001/frog/leg/ssa/nodes.dart File frog/leg/ssa/nodes.dart (right): http://codereview.chromium.org/9190038/diff/6001/frog/leg/ssa/nodes.dart#newcode1660 frog/leg/ssa/nodes.dart:1660: ...
8 years, 11 months ago (2012-01-16 14:29:50 UTC) #5
Lasse Reichstein Nielsen
Moved characters.dart to leg/util http://codereview.chromium.org/9190038/diff/6001/frog/leg/ssa/nodes.dart File frog/leg/ssa/nodes.dart (right): http://codereview.chromium.org/9190038/diff/6001/frog/leg/ssa/nodes.dart#newcode1660 frog/leg/ssa/nodes.dart:1660: hexDigit |= $a - $A; ...
8 years, 11 months ago (2012-01-17 08:50:51 UTC) #6
ahe
Scanner and test changes LGTM, but as we discussed offline, the scanner bench suffers from ...
8 years, 11 months ago (2012-01-17 13:21:38 UTC) #7
Lasse Reichstein Nielsen
8 years, 11 months ago (2012-01-18 08:22:34 UTC) #8
http://codereview.chromium.org/9190038/diff/10001/frog/leg/scanner/scanner.dart
File frog/leg/scanner/scanner.dart (right):

http://codereview.chromium.org/9190038/diff/10001/frog/leg/scanner/scanner.da...
frog/leg/scanner/scanner.dart:695: if (next === $EOF || next === $LF || next ===
$CR) {
This method has been reverted.

This shouldn't have been in tokenizeStringEscape, since I wanted to reuse it for
multiline strings (where $LF and $CR are valid).

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg/src/BuiltinI...
File frog/tests/leg/src/BuiltinInterceptorTest.dart (right):

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg/src/BuiltinI...
frog/tests/leg/src/BuiltinInterceptorTest.dart:37: } catch (Exception e) {
Good idea.

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg_only/src/Str...
File frog/tests/leg_only/src/StringEscapeTest.dart (right):

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg_only/src/Str...
frog/tests/leg_only/src/StringEscapeTest.dart:1: // Copyright (c) 2011, the Dart
project authors.  Please see the AUTHORS file
Fixed.

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg_only/src/Str...
frog/tests/leg_only/src/StringEscapeTest.dart:2: 
Cut.

http://codereview.chromium.org/9190038/diff/13001/frog/tests/leg_only/src/Str...
frog/tests/leg_only/src/StringEscapeTest.dart:6: // Test that string escapes
work correctly.
Let's keep it here until we can tests for characters > 0xffff too (i.e., when
Leg supports it).
Also, it seems the VM only accepts six hex digits in a \u{...} escape. 
Seems like it's probably a bug in the spec to allow seven.

Powered by Google App Engine
This is Rietveld 408576698