Ejemplo n.º 1
0
	void Associative_Ident(out ProtoCore.AST.AssociativeAST.AssociativeNode node) {
		ProtoCore.AST.AssociativeAST.AssociativeNode var = null; 
		Expect(1);
		if (!disableKwCheck && IsKeyWord(t.val, false, false))
		{
		   errors.SemErr(t.line, t.col, String.Format(Resources.keywordCantBeUsedAsIdentifier, t.val));
		}
		int ltype = (0 == String.Compare(t.val, "return")) ? (int)ProtoCore.PrimitiveType.kTypeReturn : (int)ProtoCore.PrimitiveType.kTypeVar;
		if (ltype == (int)ProtoCore.PrimitiveType.kTypeReturn && la.val != "=")
		{
		    SynErr(String.Format(Resources.InvalidReturnStatement, la.val));
		}
		
		var = ProtoCore.Utils.CoreUtils.BuildAssocIdentifier(core, t.val, (ProtoCore.PrimitiveType)ltype);
		NodeUtils.SetNodeLocation(var, t);
		
		#if ENABLE_INC_DEC_FIX 
		if (la.kind == 65 || la.kind == 66) {
			Associative_PostFixOp(out op);
			ProtoCore.AST.AssociativeAST.PostFixNode pfNode = new ProtoCore.AST.AssociativeAST.PostFixNode();
			pfNode.Operator = op;
			pfNode.Identifier = var;
			var = pfNode;
			
		}
		#endif 
		node = var; 
	}
Ejemplo n.º 2
0
	void Associative_Ident(out ProtoCore.AST.AssociativeAST.AssociativeNode node) {
		ProtoCore.AST.AssociativeAST.AssociativeNode var = null; 
		Expect(1);
		if (!disableKwCheck && IsKeyWord(t.val, false, false))
		{
		   errors.SemErr(t.line, t.col, String.Format("\"{0}\" is a keyword, identifier expected", t.val));
		}
		int ltype = (0 == String.Compare(t.val, "return")) ? (int)ProtoCore.PrimitiveType.kTypeReturn : (int)ProtoCore.PrimitiveType.kTypeVar;
		if (ltype == (int)ProtoCore.PrimitiveType.kTypeReturn && la.val != "=")
		{
		   SynErr("Return statement is invalid. Do you mean: return = " + la.val + " ?"); 
		}
		
		var = ProtoCore.Utils.CoreUtils.BuildAssocIdentifier(core, t.val, (ProtoCore.PrimitiveType)ltype);
		NodeUtils.SetNodeLocation(var, t);
		
		#if ENABLE_INC_DEC_FIX 
		if (la.kind == 68 || la.kind == 69) {
			Associative_PostFixOp(out op);
			ProtoCore.AST.AssociativeAST.PostFixNode pfNode = new ProtoCore.AST.AssociativeAST.PostFixNode();
			pfNode.Operator = op;
			pfNode.Identifier = var;
			var = pfNode;
			
		}
		#endif 
		node = var; 
	}