You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was writing some test cases for my Go Ink runtime engine, and testing some scenarios with numeric type coercions.
I noticed most unsupported operations produce an error like:
RUNTIME ERROR: (0.183): Cannot perform operation '-' on String
However, trying to negate a boolean literal results in a stack trace in the parser itself:
{-true}
Unhandled exception. System.Exception: Unexpected operation or number type
at Ink.Parsed.UnaryExpression.WithInner(Expression inner, String op)
at Ink.InkParser.ExpressionUnary()
at Ink.InkParser.Expression(Int32 minimumPrecedence)
at Ink.InkParser.Expression()
at Ink.StringParser.Parse[T](SpecificParseRule`1 rule)
at Ink.InkParser.ConditionExpression()
at Ink.InkParser.InnerLogic()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.Expect(ParseRule rule, String message, ParseRule recoveryRule)
at Ink.InkParser.InlineLogic()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.OneOf(ParseRule[] array)
at Ink.InkParser.InlineLogicOrGlueOrStartTag()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.<>c__DisplayClass58_0.<Optional>b__0()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.Interleave[T](ParseRule ruleA, ParseRule ruleB, ParseRule untilTerminator, Boolean flatten)
at Ink.InkParser.MixedTextAndLogic()
at Ink.StringParser.Parse[T](SpecificParseRule`1 rule)
at Ink.InkParser.LineOfMixedTextAndLogic()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.OneOf(ParseRule[] array)
at Ink.InkParser.StatementAtLevel(StatementLevel level)
at Ink.InkParser.<>c__DisplayClass145_0.<StatementsAtLevel>b__0()
at Ink.StringParser.ParseObject(ParseRule rule)
at Ink.StringParser.Interleave[T](ParseRule ruleA, ParseRule ruleB, ParseRule untilTerminator, Boolean flatten)
at Ink.InkParser.StatementsAtLevel(StatementLevel level)
at Ink.InkParser.Parse()
at Ink.Compiler.Parse()
at Ink.Compiler.Compile()
at Ink.CommandLineTool..ctor(String[] args)
at Ink.CommandLineTool.Main(String[] args)
Abort trap: 6
This seems unlikely to serve a practical purpose in a real story, but wanted to document it since this results in a big stack trace in the Inky UI if you write it there, and negating boolean values at runtime seems to be supported, e.g.:
{-(2 == 2)}
The text was updated successfully, but these errors were encountered:
I was writing some test cases for my Go Ink runtime engine, and testing some scenarios with numeric type coercions.
I noticed most unsupported operations produce an error like:
However, trying to negate a boolean literal results in a stack trace in the parser itself:
This seems unlikely to serve a practical purpose in a real story, but wanted to document it since this results in a big stack trace in the Inky UI if you write it there, and negating boolean values at runtime seems to be supported, e.g.:
The text was updated successfully, but these errors were encountered: