Skip to content

Commit

Permalink
(#72) Parser: fixes after the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Mar 27, 2022
1 parent f040d95 commit 7659e22
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 8 deletions.
7 changes: 7 additions & 0 deletions Cesium.CodeGen.Tests/Cesium.CodeGen.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@
<ProjectReference Include="..\Cesium.Test.Framework\Cesium.Test.Framework.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="verified\CodeGenMethodTests.AmbiguousCallTest.verified.txt">
<ParentFile>CodeGenMethodTests</ParentFile>
<DependentUpon>CodeGenMethodTests.cs</DependentUpon>
</None>
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions Cesium.Parser.Tests/Cesium.Parser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@
<ParentFile>StatementParserTests</ParentFile>
<DependentUpon>StatementParserTests.cs</DependentUpon>
</None>
<None Update="ParserTests\verified\DeclarationParserTests.ComplexFunctionPointerTypeDef.verified.txt">
<ParentFile>DeclarationParserTests</ParentFile>
<DependentUpon>DeclarationParserTests.cs</DependentUpon>
</None>
<None Update="ParserTests\verified\DeclarationParserTests.FunctionPointerTypeDef.verified.txt">
<ParentFile>DeclarationParserTests</ParentFile>
<DependentUpon>DeclarationParserTests.cs</DependentUpon>
</None>
<None Update="ParserTests\verified\DeclarationParserTests.FunctionTypeDef.verified.txt">
<ParentFile>DeclarationParserTests</ParentFile>
<DependentUpon>DeclarationParserTests.cs</DependentUpon>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
},
"Arguments": [
{
"$type": "Cesium.Ast.NegationExpression, Cesium.Ast",
"$type": "Cesium.Ast.UnaryOperatorExpression, Cesium.Ast",
"Operator": "-",
"Target": {
"$type": "Cesium.Ast.ConstantExpression, Cesium.Ast",
"Constant": {
Expand All @@ -76,8 +77,8 @@
},
{
"$type": "Cesium.Ast.AmbiguousBlockItem, Cesium.Ast",
"PossibleFunction": "exit",
"PossibleArgument": "exitCode"
"Item1": "exit",
"Item2": "exitCode"
}
]
}
Expand Down
12 changes: 7 additions & 5 deletions Cesium.Parser/CParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,21 @@ private static IfElseStatement MakeIfStatement(
IToken __,
Expression expression,
IToken ___,
Statement statement)
=> new(expression, statement, null);
IBlockItem statement) =>
// TODO[#115]: This direct cast should't be necessary. It is here because of the "lexer hack".
new(expression, (Statement)statement, null);

[Rule("selection_statement: 'if' '(' expression ')' statement 'else' statement")]
private static IfElseStatement MakeIfElseStatement(
IToken _,
IToken __,
Expression expression,
IToken ___,
Statement trueBranch,
IBlockItem trueBranch,
IToken ____,
Statement falseBranch)
=> new(expression, trueBranch, falseBranch);
IBlockItem falseBranch)
// TODO[#115]: These direct casts should't be necessary. They are here because of the "lexer hack".
=> new(expression, (Statement)trueBranch, (Statement)falseBranch);
// TODO: 6.8.4 Selection statements switch

// TODO: 6.8.5 Iteration statements
Expand Down

0 comments on commit 7659e22

Please sign in to comment.