-
-
Notifications
You must be signed in to change notification settings - Fork 38
Revert to the use of StringMacroName/CmdMacroName kinds #583
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
209ca63
Revert to the use of StringMacroName/CmdMacroName kinds
c42f b7a7ef2
fixup! Revert to the use of StringMacroName/CmdMacroName kinds
c42f d5cd3d7
fixup! Revert to the use of StringMacroName/CmdMacroName kinds
c42f 2ef16a0
fixup! fixup! Revert to the use of StringMacroName/CmdMacroName kinds
c42f File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -463,28 +463,30 @@ tests = [ | |
"S{a,b}" => "(curly S a b)" | ||
"T{y for x = xs; a}" => "(curly T (generator y (iteration (in x xs))) (parameters a))" | ||
# String macros | ||
"x\"str\"" => """(macrocall (macro_name_str x) (string-r "str"))""" | ||
"x`str`" => """(macrocall (macro_name_cmd x) (cmdstring-r "str"))""" | ||
"x\"\"" => """(macrocall (macro_name_str x) (string-r ""))""" | ||
"x``" => """(macrocall (macro_name_cmd x) (cmdstring-r ""))""" | ||
"in\"str\"" => """(macrocall (macro_name_str in) (string-r "str"))""" | ||
"outer\"str\"" => """(macrocall (macro_name_str outer) (string-r "str"))""" | ||
"x\"str\"" => """(macrocall @x_str (string-r "str"))""" | ||
"x`str`" => """(macrocall @x_cmd (cmdstring-r "str"))""" | ||
"x\"\"" => """(macrocall @x_str (string-r ""))""" | ||
"x``" => """(macrocall @x_cmd (cmdstring-r ""))""" | ||
"in\"str\"" => """(macrocall @in_str (string-r "str"))""" | ||
"outer\"str\"" => """(macrocall @outer_str (string-r "str"))""" | ||
"A.x\"str\"" => """(macrocall (. A @x_str) (string-r "str"))""" | ||
"A.x`str`" => """(macrocall (. A @x_cmd) (cmdstring-r "str"))""" | ||
# Triple quoted processing for custom strings | ||
"r\"\"\"\nx\"\"\"" => raw"""(macrocall (macro_name_str r) (string-s-r "x"))""" | ||
"r\"\"\"\n x\n y\"\"\"" => raw"""(macrocall (macro_name_str r) (string-s-r "x\n" "y"))""" | ||
"r\"\"\"\n x\\\n y\"\"\"" => raw"""(macrocall (macro_name_str r) (string-s-r "x\\\n" "y"))""" | ||
"r\"\"\"\nx\"\"\"" => raw"""(macrocall @r_str (string-s-r "x"))""" | ||
"r\"\"\"\n x\n y\"\"\"" => raw"""(macrocall @r_str (string-s-r "x\n" "y"))""" | ||
"r\"\"\"\n x\\\n y\"\"\"" => raw"""(macrocall @r_str (string-s-r "x\\\n" "y"))""" | ||
# Macro suffixes can include keywords and numbers | ||
"x\"s\"y" => """(macrocall (macro_name_str x) (string-r "s") "y")""" | ||
"x\"s\"end" => """(macrocall (macro_name_str x) (string-r "s") "end")""" | ||
"x\"s\"in" => """(macrocall (macro_name_str x) (string-r "s") "in")""" | ||
"x\"s\"2" => """(macrocall (macro_name_str x) (string-r "s") 2)""" | ||
"x\"s\"10.0" => """(macrocall (macro_name_str x) (string-r "s") 10.0)""" | ||
"x\"s\"y" => """(macrocall @x_str (string-r "s") "y")""" | ||
"x\"s\"end" => """(macrocall @x_str (string-r "s") "end")""" | ||
"x\"s\"in" => """(macrocall @x_str (string-r "s") "in")""" | ||
"x\"s\"2" => """(macrocall @x_str (string-r "s") 2)""" | ||
"x\"s\"10.0" => """(macrocall @x_str (string-r "s") 10.0)""" | ||
# Cmd macro suffixes | ||
"x`s`y" => """(macrocall (macro_name_cmd x) (cmdstring-r "s") "y")""" | ||
"x`s`end" => """(macrocall (macro_name_cmd x) (cmdstring-r "s") "end")""" | ||
"x`s`in" => """(macrocall (macro_name_cmd x) (cmdstring-r "s") "in")""" | ||
"x`s`2" => """(macrocall (macro_name_cmd x) (cmdstring-r "s") 2)""" | ||
"x`s`10.0" => """(macrocall (macro_name_cmd x) (cmdstring-r "s") 10.0)""" | ||
"x`s`y" => """(macrocall @x_cmd (cmdstring-r "s") "y")""" | ||
"x`s`end" => """(macrocall @x_cmd (cmdstring-r "s") "end")""" | ||
"x`s`in" => """(macrocall @x_cmd (cmdstring-r "s") "in")""" | ||
"x`s`2" => """(macrocall @x_cmd (cmdstring-r "s") 2)""" | ||
"x`s`10.0" => """(macrocall @x_cmd (cmdstring-r "s") 10.0)""" | ||
], | ||
JuliaSyntax.parse_resword => [ | ||
# In normal_context | ||
|
@@ -1167,6 +1169,9 @@ parsestmt_with_kind_tests = [ | |
"a >>= b" => "(op= a::Identifier >>::Identifier b::Identifier)" | ||
":+=" => "(quote-: +=::op=)" | ||
":.+=" => "(quote-: (. +=::op=))" | ||
# str/cmd macro name kinds | ||
"x\"str\"" => """(macrocall x::StringMacroName (string-r "str"::String))""" | ||
"x`str`" => """(macrocall x::CmdMacroName (cmdstring-r "str"::CmdString))""" | ||
] | ||
|
||
@testset "parser `Kind` remapping" begin | ||
|
@@ -1195,13 +1200,12 @@ end | |
# ɛµ normalizes to εμ | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "\u025B\u00B5()") == "(call \u03B5\u03BC)" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "@\u025B\u00B5") == "(macrocall (macro_name \u03B5\u03BC))" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "\u025B\u00B5\"\"") == "(macrocall (macro_name_str \u03B5\u03BC) (string-r \"\"))" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "\u025B\u00B5``") == "(macrocall (macro_name_cmd \u03B5\u03BC) (cmdstring-r \"\"))" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "\u025B\u00B5\"\"") == "(macrocall @\u03B5\u03BC_str (string-r \"\"))" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "\u025B\u00B5``") == "(macrocall @\u03B5\u03BC_cmd (cmdstring-r \"\"))" | ||
# · and · normalize to ⋅ | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "a \u00B7 b") == "(call-i a \u22C5 b)" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "a \u0387 b") == "(call-i a \u22C5 b)" | ||
# − ('\u2212') normalizes to - ('\u002d') | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_expr, "a \u2212 b") == "(call-i a - b)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, no idea what happened here, yikes |
||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "a \u2212= b") == "(op= a - b)" | ||
@test parse_to_sexpr_str(JuliaSyntax.parse_eq, "a .\u2212= b") == "(.op= a - b)" | ||
end | ||
|
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.
Should be kept. This is JuliaLang/julia#58885
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.
Good catch, thanks. My mistake in doing the partial-revert I'll do a closer self-review of the test changes.