JSSpecCompiler: Parse '?' before function calls in xspec mode
This commit is contained in:
parent
b800276347
commit
3d365326af
Notes:
sideshowbarker
2024-07-17 03:03:37 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/3d365326af Pull-request: https://github.com/SerenityOS/serenity/pull/23123 Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 20 additions and 1 deletions
Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler
|
@ -242,7 +242,8 @@ protected:
|
|||
#define ENUMERATE_UNARY_OPERATORS(F) \
|
||||
F(Invalid) \
|
||||
F(AssertCompletion) \
|
||||
F(Minus)
|
||||
F(Minus) \
|
||||
F(ReturnIfAbrubt)
|
||||
|
||||
#define ENUMERATE_BINARY_OPERATORS(F) \
|
||||
F(Invalid) \
|
||||
|
|
|
@ -71,6 +71,7 @@ void tokenize_string(SpecificationParsingContext& ctx, XML::Node const* node, St
|
|||
{ ")"sv, TokenType::ParenClose },
|
||||
{ "("sv, TokenType::ParenOpen },
|
||||
{ "+"sv, TokenType::Plus },
|
||||
{ "?"sv, TokenType::QuestionMark },
|
||||
};
|
||||
|
||||
LineTrackingLexer lexer(view, node->offset);
|
||||
|
|
|
@ -44,6 +44,7 @@ constexpr i32 closing_bracket_precedence = 18;
|
|||
F(ParenClose, 18, Invalid, Invalid, ParenOpen, "')'") \
|
||||
F(ParenOpen, -1, Invalid, Invalid, ParenClose, "'('") \
|
||||
F(Plus, 6, Invalid, Plus, Invalid, "plus") \
|
||||
F(QuestionMark, 3, ReturnIfAbrubt, Invalid, Invalid, "question mark") \
|
||||
F(SectionNumber, -1, Invalid, Invalid, Invalid, "section number") \
|
||||
F(String, -1, Invalid, Invalid, Invalid, "string literal") \
|
||||
F(Superscript, 4, Invalid, Power, Invalid, "subscript") \
|
||||
|
|
|
@ -33,4 +33,12 @@
|
|||
</ol>
|
||||
</emu-alg>
|
||||
</emu-clause>
|
||||
<emu-clause id="3" aoid="TestReturnIfAbrupt">
|
||||
<h1><span class="secnum">3</span> TestReturnIfAbrupt ( <var>a</var> )</h1>
|
||||
<emu-alg>
|
||||
<ol>
|
||||
<li>Return ? <emu-xref><a>WellKnownConstants</a></emu-xref>(<var>a</var>).</li>
|
||||
</ol>
|
||||
</emu-alg>
|
||||
</emu-clause>
|
||||
</specification>
|
||||
|
|
|
@ -46,3 +46,11 @@ TreeList
|
|||
ReturnNode
|
||||
WellKnownNode False
|
||||
|
||||
TestReturnIfAbrupt(a):
|
||||
TreeList
|
||||
ReturnNode
|
||||
UnaryOperation ReturnIfAbrubt
|
||||
FunctionCall
|
||||
Func "WellKnownConstants"
|
||||
Var a
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue