Commit 00f3ab17 authored by Théotime Grohens's avatar Théotime Grohens Committed by Commit Bot

[torque] Add '\n' handling in Torque strings

This CL adds the newline character as a valid character
in Torque strings.

You can now write Print('Hello, World!\n') in Torque and it works!

Change-Id: I2a1f87cfef492fedd3d24086e226d3ebaf882115
Reviewed-on: https://chromium-review.googlesource.com/1118229Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Théotime Grohens <theotime@google.com>
Cr-Commit-Position: refs/heads/master@{#54089}
parent bb8aadb7
...@@ -81,7 +81,7 @@ NOT: '!'; ...@@ -81,7 +81,7 @@ NOT: '!';
STRING_LITERAL : ('"' ( ESCAPE | ~('"' | '\\' | '\n' | '\r') ) * '"') STRING_LITERAL : ('"' ( ESCAPE | ~('"' | '\\' | '\n' | '\r') ) * '"')
| ('\'' ( ESCAPE | ~('\'' | '\\' | '\n' | '\r') ) * '\''); | ('\'' ( ESCAPE | ~('\'' | '\\' | '\n' | '\r') ) * '\'');
fragment ESCAPE : '\\' ( '\'' | '\\' | '"' ); fragment ESCAPE : '\\' ( '\'' | '\\' | '"' | 'n' | 'r' );
IDENTIFIER : [A-Za-z][0-9A-Za-z_]* ; IDENTIFIER : [A-Za-z][0-9A-Za-z_]* ;
......
This diff is collapsed.
...@@ -219,4 +219,8 @@ module test { ...@@ -219,4 +219,8 @@ module test {
check(someVeryLongVariableNameThatWillCauseLineBreaks > 0 check(someVeryLongVariableNameThatWillCauseLineBreaks > 0
&& someVeryLongVariableNameThatWillCauseLineBreaks < 10); && someVeryLongVariableNameThatWillCauseLineBreaks < 10);
} }
macro TestNewlineInString() {
Print('Hello, World!\n');
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment