-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringLiteral
#4
Merged
Merged
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b6af384
Add `String` literals
imteekay 6d8e517
Merge branch 'main' into string-literals
imteekay f56c6dd
Scan single quote
imteekay e158033
Support double quote
imteekay d2d3efd
Add baselines
imteekay 53ae450
Update baselines
imteekay 0b5d70f
merge with master
imteekay a1df2c7
typecheck string literals
imteekay 4e4d434
Merge branch 'main' into string-literals
imteekay 3d70d3b
check "Add string literals" exercise
imteekay ba4c745
Merge branch 'main' into string-literals
imteekay 60ceb41
Improve string literal
imteekay bc76e30
Return char for invalid escapes
imteekay c5e8220
Fix escape sequence
imteekay ead71e2
Add more tests
imteekay b04fc8a
Fix some baselines references
imteekay 191b18c
Merge branch 'main' into string-literals
imteekay 0958d11
Merge branch 'main' into string-literals
imteekay 65a3270
Add exercise to add support for the lexer to report errors
imteekay 282af71
Fix all baselines after mergin with master
imteekay d8cae0e
Remove build
imteekay de468a7
Rename files
imteekay 459e037
Add exercise to rename `Literal` to `NumericLiteral`
imteekay File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"var s = 1" | ||
"var s = 1;\nvar n = 'test';\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"var singleQuote = 'singleQuote';\nvar doubleQuote = \"doubleQuote\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"locals": { | ||
"singleQuote": [ | ||
{ | ||
"kind": "Var", | ||
"pos": 3 | ||
} | ||
], | ||
"doubleQuote": [ | ||
{ | ||
"kind": "Var", | ||
"pos": 36 | ||
} | ||
] | ||
}, | ||
"statements": [ | ||
{ | ||
"kind": "Var", | ||
"name": { | ||
"kind": "Identifier", | ||
"text": "singleQuote" | ||
}, | ||
"init": { | ||
"kind": "Literal", | ||
"value": "'singleQuote'" | ||
} | ||
}, | ||
{ | ||
"kind": "Var", | ||
"name": { | ||
"kind": "Identifier", | ||
"text": "doubleQuote" | ||
}, | ||
"init": { | ||
"kind": "Literal", | ||
"value": "\"doubleQuote\"" | ||
} | ||
}, | ||
{ | ||
"kind": "EmptyStatement" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
var s: string = 1; | ||
var n: number = 'test'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var singleQuote = 'singleQuote'; | ||
var doubleQuote = "doubleQuote"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings should be able to contain any character except the matching
"
or'
. And you'll need to allow for escaping like with\'
as well.