Start simple string at quote mark

This commit is contained in:
Charlie Marsh 2022-10-16 11:25:46 -04:00
parent 15e2ac3fd7
commit ca62bd1593
11 changed files with 31 additions and 33 deletions

View file

@ -492,9 +492,9 @@ where
is_unicode: bool, is_unicode: bool,
is_fstring: bool, is_fstring: bool,
) -> LexResult { ) -> LexResult {
let start_pos = self.get_pos();
let quote_char = self.next_char().unwrap(); let quote_char = self.next_char().unwrap();
let mut string_content = String::new(); let mut string_content = String::new();
let start_pos = self.get_pos();
// If the next two characters are also the quote character, then we have a triple-quoted // If the next two characters are also the quote character, then we have a triple-quoted
// string; consume those two characters and ensure that we require a triple-quote to close // string; consume those two characters and ensure that we require a triple-quote to close

View file

@ -1,6 +1,6 @@
--- ---
source: parser/src/parser.rs source: compiler/parser/src/parser.rs
expression: parse_program(&source).unwrap() expression: "parse_program(source, \"<test>\").unwrap()"
--- ---
[ [
Located { Located {
@ -126,7 +126,7 @@ expression: parse_program(&source).unwrap()
Located { Located {
location: Location { location: Location {
row: 4, row: 4,
column: 37, column: 36,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,7 +1,6 @@
--- ---
source: parser/src/parser.rs source: compiler/parser/src/parser.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
@ -33,7 +32,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 10, column: 9,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,7 +1,6 @@
--- ---
source: parser/src/parser.rs source: compiler/parser/src/parser.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
@ -33,7 +32,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 8, column: 7,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,5 +1,5 @@
--- ---
source: parser/src/parser.rs source: compiler/parser/src/parser.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
@ -32,7 +32,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 8, column: 7,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,19 +1,19 @@
--- ---
source: parser/src/parser.rs source: compiler/parser/src/parser.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,19 +1,19 @@
--- ---
source: parser/src/string.rs source: compiler/parser/src/string.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: JoinedStr { node: JoinedStr {
@ -21,7 +21,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,19 +1,19 @@
--- ---
source: parser/src/string.rs source: compiler/parser/src/string.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: JoinedStr { node: JoinedStr {
@ -21,7 +21,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -6,14 +6,14 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: JoinedStr { node: JoinedStr {
@ -21,7 +21,7 @@ expression: parse_ast
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {
@ -41,7 +41,7 @@ expression: parse_ast
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 3, column: 2,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,19 +1,19 @@
--- ---
source: parser/src/string.rs source: compiler/parser/src/string.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {

View file

@ -1,19 +1,19 @@
--- ---
source: parser/src/string.rs source: compiler/parser/src/string.rs
expression: parse_ast expression: parse_ast
--- ---
[ [
Located { Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Expr { node: Expr {
value: Located { value: Located {
location: Location { location: Location {
row: 1, row: 1,
column: 2, column: 1,
}, },
custom: (), custom: (),
node: Constant { node: Constant {