MCPcopy Create free account
hub / github.com/devosoft/avida / parseIDStatement

Method parseIDStatement

avida-core/source/script/cParser.cc:803–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803cASTNode* cParser::parseIDStatement()
804{
805 PARSE_TRACE("parseIDStatement");
806
807 switch (peekToken()) {
808 case TOKEN(ASSIGN):
809 return parseAssignment();
810 break;
811 case TOKEN(PREC_OPEN):
812 {
813 cASTFunctionCall* fc = new cASTFunctionCall(FILEPOS, currentText());
814 nextToken(); // consume id token
815 if (nextToken() != TOKEN(PREC_CLOSE)) fc->SetArguments(parseArgumentList());
816 if (currentToken() != TOKEN(PREC_CLOSE)) PARSE_UNEXPECT();
817 nextToken(); // consume ')'
818
819 if (currentToken() == TOKEN(DOT) || currentToken() == TOKEN(IDX_OPEN)) {
820 return parseCallExpression(fc, true);
821 }
822
823 return fc;
824 }
825 break;
826 case TOKEN(DOT):
827 case TOKEN(IDX_OPEN):
828 cASTNode* target = new cASTVariableReference(FILEPOS, currentText());
829 nextToken(); // consume id
830 return parseCallExpression(target, true);
831 break;
832 case TOKEN(REF):
833 return parseVariableDefinition();
834 break;
835
836 default:
837 PARSE_UNEXPECT();
838 }
839}
840
841cASTNode* cParser::parseIfStatement()
842{

Callers

nothing calls this directly

Calls 1

SetArgumentsMethod · 0.45

Tested by

no test coverage detected