MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / ParseConstant

Method ParseConstant

src/server/angelscript/angelscript/source/as_parser.cpp:1590–1620  ·  view source on GitHub ↗

BNF:12: LITERAL ::= NUMBER | STRING | BITS | 'true' | 'false' | 'null' BNF:17: NUMBER ::= single token: includes integers and real numbers, same as C++ BNF:17: STRING ::= single token: single quoted ', double quoted ", or heredoc multi-line string """ BNF:17: BITS ::= single token: binary 0b or 0B, octal 0o or 0O, decimal 0d or 0D, hexadecimal 0x or 0X

Source from the content-addressed store, hash-verified

1588// BNF:17: STRING ::= single token: single quoted ', double quoted ", or heredoc multi-line string """
1589// BNF:17: BITS ::= single token: binary 0b or 0B, octal 0o or 0O, decimal 0d or 0D, hexadecimal 0x or 0X
1590asCScriptNode *asCParser::ParseConstant()
1591{
1592 asCScriptNode *node = CreateNode(snConstant);
1593 if( node == 0 ) return 0;
1594
1595 sToken t;
1596 GetToken(&t);
1597 if( !IsConstant(t.type) )
1598 {
1599 Error(TXT_EXPECTED_CONSTANT, &t);
1600 Error(InsteadFound(t), &t);
1601 return node;
1602 }
1603
1604 node->SetToken(&t);
1605 node->UpdateSourcePos(t.pos, t.length);
1606
1607 // We want to gather a list of string constants to concatenate as children
1608 if( t.type == ttStringConstant || t.type == ttMultilineStringConstant || t.type == ttHeredocStringConstant )
1609 RewindTo(&t);
1610
1611 while( t.type == ttStringConstant || t.type == ttMultilineStringConstant || t.type == ttHeredocStringConstant )
1612 {
1613 node->AddChildLast(ParseStringConstant());
1614
1615 GetToken(&t);
1616 RewindTo(&t);
1617 }
1618
1619 return node;
1620}
1621
1622bool asCParser::IsLambda()
1623{

Callers

nothing calls this directly

Calls 3

SetTokenMethod · 0.80
UpdateSourcePosMethod · 0.80
AddChildLastMethod · 0.80

Tested by

no test coverage detected