mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:47:34 +00:00
JSSpecCompiler: Parse '?' before function calls in xspec mode
This commit is contained in:
parent
b800276347
commit
3d365326af
5 changed files with 20 additions and 1 deletions
|
@ -242,7 +242,8 @@ protected:
|
||||||
#define ENUMERATE_UNARY_OPERATORS(F) \
|
#define ENUMERATE_UNARY_OPERATORS(F) \
|
||||||
F(Invalid) \
|
F(Invalid) \
|
||||||
F(AssertCompletion) \
|
F(AssertCompletion) \
|
||||||
F(Minus)
|
F(Minus) \
|
||||||
|
F(ReturnIfAbrubt)
|
||||||
|
|
||||||
#define ENUMERATE_BINARY_OPERATORS(F) \
|
#define ENUMERATE_BINARY_OPERATORS(F) \
|
||||||
F(Invalid) \
|
F(Invalid) \
|
||||||
|
|
|
@ -71,6 +71,7 @@ void tokenize_string(SpecificationParsingContext& ctx, XML::Node const* node, St
|
||||||
{ ")"sv, TokenType::ParenClose },
|
{ ")"sv, TokenType::ParenClose },
|
||||||
{ "("sv, TokenType::ParenOpen },
|
{ "("sv, TokenType::ParenOpen },
|
||||||
{ "+"sv, TokenType::Plus },
|
{ "+"sv, TokenType::Plus },
|
||||||
|
{ "?"sv, TokenType::QuestionMark },
|
||||||
};
|
};
|
||||||
|
|
||||||
LineTrackingLexer lexer(view, node->offset);
|
LineTrackingLexer lexer(view, node->offset);
|
||||||
|
|
|
@ -44,6 +44,7 @@ constexpr i32 closing_bracket_precedence = 18;
|
||||||
F(ParenClose, 18, Invalid, Invalid, ParenOpen, "')'") \
|
F(ParenClose, 18, Invalid, Invalid, ParenOpen, "')'") \
|
||||||
F(ParenOpen, -1, Invalid, Invalid, ParenClose, "'('") \
|
F(ParenOpen, -1, Invalid, Invalid, ParenClose, "'('") \
|
||||||
F(Plus, 6, Invalid, Plus, Invalid, "plus") \
|
F(Plus, 6, Invalid, Plus, Invalid, "plus") \
|
||||||
|
F(QuestionMark, 3, ReturnIfAbrubt, Invalid, Invalid, "question mark") \
|
||||||
F(SectionNumber, -1, Invalid, Invalid, Invalid, "section number") \
|
F(SectionNumber, -1, Invalid, Invalid, Invalid, "section number") \
|
||||||
F(String, -1, Invalid, Invalid, Invalid, "string literal") \
|
F(String, -1, Invalid, Invalid, Invalid, "string literal") \
|
||||||
F(Superscript, 4, Invalid, Power, Invalid, "subscript") \
|
F(Superscript, 4, Invalid, Power, Invalid, "subscript") \
|
||||||
|
|
|
@ -33,4 +33,12 @@
|
||||||
</ol>
|
</ol>
|
||||||
</emu-alg>
|
</emu-alg>
|
||||||
</emu-clause>
|
</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>
|
</specification>
|
||||||
|
|
|
@ -46,3 +46,11 @@ TreeList
|
||||||
ReturnNode
|
ReturnNode
|
||||||
WellKnownNode False
|
WellKnownNode False
|
||||||
|
|
||||||
|
TestReturnIfAbrupt(a):
|
||||||
|
TreeList
|
||||||
|
ReturnNode
|
||||||
|
UnaryOperation ReturnIfAbrubt
|
||||||
|
FunctionCall
|
||||||
|
Func "WellKnownConstants"
|
||||||
|
Var a
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue