public static bool TryParseNode(Genero4glParser parser, out ActionAttributesListmodTriggers node) { node = new ActionAttributesListmodTriggers(); node.StartIndex = parser.Token.Span.Start; bool result = true; switch (parser.PeekToken().Kind) { case TokenKind.TextKeyword: case TokenKind.CommentKeyword: case TokenKind.ImageKeyword: case TokenKind.AcceleratorKeyword: { parser.NextToken(); if (parser.PeekToken(TokenKind.Equals)) { parser.NextToken(); } else { parser.ReportSyntaxError("Expected equals token in display attribute."); } // get the help number StringExpressionNode stringExpressionNode; if (!StringExpressionNode.TryGetExpressionNode(parser, out stringExpressionNode)) { parser.ReportSyntaxError("Invalid string expression found in action attribute."); } } break; case TokenKind.DefaultViewKeyword: case TokenKind.ContextMenuKeyword: { parser.NextToken(); if (parser.PeekToken(TokenKind.Equals)) { var tokKind = parser.NextToken().Kind; if (tokKind != TokenKind.YesKeyword || tokKind != TokenKind.NoKeyword || tokKind != TokenKind.AutoKeyword) { parser.ReportSyntaxError("Invalid token found in action attribute."); } } else { parser.ReportSyntaxError("Expected equals token in display attribute."); } } break; default: result = false; break; } return(result); }
private static List <ActionAttributesListmodTriggers> GetActionAttributesListmodTriggers(Genero4glParser parser) { List <ActionAttributesListmodTriggers> result = new List <ActionAttributesListmodTriggers>(); // get the optional attributes if (parser.PeekToken(TokenKind.AttributesKeyword) || parser.PeekToken(TokenKind.AttributeKeyword)) { parser.NextToken(); if (parser.PeekToken(TokenKind.LeftParenthesis)) { parser.NextToken(); ActionAttributesListmodTriggers attrib; while (ActionAttributesListmodTriggers.TryParseNode(parser, out attrib)) { result.Add(attrib); if (!parser.PeekToken(TokenKind.Comma)) { break; } parser.NextToken(); } if (parser.PeekToken(TokenKind.RightParenthesis)) { parser.NextToken(); } else { parser.ReportSyntaxError("Expecting right-paren in display attributes section."); } } else { parser.ReportSyntaxError("Expecting left-paren in display attributes section."); } } return(result); }