| /** |
| * |
| * Copyright (c) 2007 OptXware Research and Development LLC. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Daniel Varro - Initial API and implementation |
| * |
| * This file was generated automatically based upon the VTCL LPG Lexer |
| * VTCLKWLexer.g (and btVTCLParserTemplateD.g) |
| */ |
| |
| package org.eclipse.viatra2.lpgparser; |
| |
| import lpg.lpgjavaruntime.*;
|
| |
| public class VTCLKWLexer extends VTCLKWLexerprs implements VTCLParsersym
|
| {
|
| private char[] inputChars;
|
| private final int keywordKind[] = new int[87 + 1];
|
|
|
| public int[] getKeywordKinds() { return keywordKind; }
|
|
|
| public int lexer(int curtok, int lasttok)
|
| {
|
| int current_kind = getKind(inputChars[curtok]),
|
| act;
|
|
|
| for (act = tAction(START_STATE, current_kind);
|
| act > NUM_RULES && act < ACCEPT_ACTION;
|
| act = tAction(act, current_kind))
|
| {
|
| curtok++;
|
| current_kind = (curtok > lasttok
|
| ? Char_EOF
|
| : getKind(inputChars[curtok]));
|
| }
|
|
|
| if (act > ERROR_ACTION)
|
| {
|
| curtok++;
|
| act -= ERROR_ACTION;
|
| }
|
|
|
| return keywordKind[act == ERROR_ACTION || curtok <= lasttok ? 0 : act];
|
| }
|
|
|
| public void setInputChars(char[] inputChars) { this.inputChars = inputChars; }
|
|
|
| final static int tokenKind[] = new int[128]; |
| static |
| { |
| tokenKind['_'] = Char__; |
| |
| tokenKind['a'] = Char_a; |
| tokenKind['b'] = Char_b; |
| tokenKind['c'] = Char_c; |
| tokenKind['d'] = Char_d; |
| tokenKind['e'] = Char_e; |
| tokenKind['f'] = Char_f; |
| tokenKind['g'] = Char_g; |
| tokenKind['h'] = Char_h; |
| tokenKind['i'] = Char_i; |
| tokenKind['j'] = Char_j; |
| tokenKind['k'] = Char_k; |
| tokenKind['l'] = Char_l; |
| tokenKind['m'] = Char_m; |
| tokenKind['n'] = Char_n; |
| tokenKind['o'] = Char_o; |
| tokenKind['p'] = Char_p; |
| tokenKind['q'] = Char_q; |
| tokenKind['r'] = Char_r; |
| tokenKind['s'] = Char_s; |
| tokenKind['t'] = Char_t; |
| tokenKind['u'] = Char_u; |
| tokenKind['v'] = Char_v; |
| tokenKind['w'] = Char_w; |
| tokenKind['x'] = Char_x; |
| tokenKind['y'] = Char_y; |
| tokenKind['z'] = Char_z; |
| |
| tokenKind['A'] = Char_A; |
| tokenKind['B'] = Char_B; |
| tokenKind['C'] = Char_C; |
| tokenKind['D'] = Char_D; |
| tokenKind['E'] = Char_E; |
| tokenKind['F'] = Char_F; |
| tokenKind['G'] = Char_G; |
| tokenKind['H'] = Char_H; |
| tokenKind['I'] = Char_I; |
| tokenKind['J'] = Char_J; |
| tokenKind['K'] = Char_K; |
| tokenKind['L'] = Char_L; |
| tokenKind['M'] = Char_M; |
| tokenKind['N'] = Char_N; |
| tokenKind['O'] = Char_O; |
| tokenKind['P'] = Char_P; |
| tokenKind['Q'] = Char_Q; |
| tokenKind['R'] = Char_R; |
| tokenKind['S'] = Char_S; |
| tokenKind['T'] = Char_T; |
| tokenKind['U'] = Char_U; |
| tokenKind['V'] = Char_V; |
| tokenKind['W'] = Char_W; |
| tokenKind['X'] = Char_X; |
| tokenKind['Y'] = Char_Y; |
| tokenKind['Z'] = Char_Z; |
| }; |
| |
| final int getKind(char c) |
| { |
| return (c < 128 ? tokenKind[c] : 0); |
| } |
| |
|
|
| public VTCLKWLexer(char[] inputChars, int identifierKind)
|
| {
|
| this.inputChars = inputChars;
|
| keywordKind[0] = identifierKind;
|
|
|
| //
|
| // Rule 1: KeyWord ::= n a m e s p a c e
|
| // |
| keywordKind[1] = (TK_namespace); |
| |
|
|
| //
|
| // Rule 2: KeyWord ::= i m p o r t
|
| // |
| keywordKind[2] = (TK_import); |
| |
|
|
| //
|
| // Rule 3: KeyWord ::= m a c h i n e
|
| // |
| keywordKind[3] = (TK_machine); |
| |
|
|
| //
|
| // Rule 4: KeyWord ::= p a t t e r n
|
| // |
| keywordKind[4] = (TK_pattern); |
| |
|
|
| //
|
| // Rule 5: KeyWord ::= o r
|
| // |
| keywordKind[5] = (TK_or); |
| |
|
|
| //
|
| // Rule 6: KeyWord ::= n e g
|
| // |
| keywordKind[6] = (TK_neg); |
| |
|
|
| //
|
| // Rule 7: KeyWord ::= f i n d
|
| // |
| keywordKind[7] = (TK_find); |
| |
|
|
| //
|
| // Rule 8: KeyWord ::= c h e c k
|
| // |
| keywordKind[8] = (TK_check); |
| |
|
|
| //
|
| // Rule 9: KeyWord ::= s u p e r t y p e O f
|
| // |
| keywordKind[9] = (TK_supertypeOf); |
| |
|
|
| //
|
| // Rule 10: KeyWord ::= s u b t y p e O f
|
| // |
| keywordKind[10] = (TK_subtypeOf); |
| |
|
|
| //
|
| // Rule 11: KeyWord ::= t y p e O f
|
| // |
| keywordKind[11] = (TK_typeOf); |
| |
|
|
| //
|
| // Rule 12: KeyWord ::= i n s t a n c e O f
|
| // |
| keywordKind[12] = (TK_instanceOf); |
| |
|
|
| //
|
| // Rule 13: KeyWord ::= g t r u l e
|
| // |
| keywordKind[13] = (TK_gtrule); |
| |
|
|
| //
|
| // Rule 14: KeyWord ::= p r e c o n d i t i o n
|
| // |
| keywordKind[14] = (TK_precondition); |
| |
|
|
| //
|
| // Rule 15: KeyWord ::= p o s t c o n d i t i o n
|
| // |
| keywordKind[15] = (TK_postcondition); |
| |
|
|
| //
|
| // Rule 16: KeyWord ::= a c t i o n
|
| // |
| keywordKind[16] = (TK_action); |
| |
|
|
| //
|
| // Rule 17: KeyWord ::= a p p l y
|
| // |
| keywordKind[17] = (TK_apply); |
| |
|
|
| //
|
| // Rule 18: KeyWord ::= x o r
|
| // |
| keywordKind[18] = (TK_xor); |
| |
|
|
| //
|
| // Rule 19: KeyWord ::= a s m f u n c t i o n
|
| // |
| keywordKind[19] = (TK_asmfunction); |
| |
|
|
| //
|
| // Rule 20: KeyWord ::= r u l e
|
| // |
| keywordKind[20] = (TK_rule); |
| |
|
|
| //
|
| // Rule 21: KeyWord ::= o u t
|
| // |
| keywordKind[21] = (TK_out); |
| |
|
|
| //
|
| // Rule 22: KeyWord ::= i n o u t
|
| // |
| keywordKind[22] = (TK_inout); |
| |
|
|
| //
|
| // Rule 23: KeyWord ::= f a i l
|
| // |
| keywordKind[23] = (TK_fail); |
| |
|
|
| //
|
| // Rule 24: KeyWord ::= c a l l
|
| // |
| keywordKind[24] = (TK_call); |
| |
|
|
| //
|
| // Rule 25: KeyWord ::= u p d a t e
|
| // |
| keywordKind[25] = (TK_update); |
| |
|
|
| //
|
| // Rule 26: KeyWord ::= p r i n t
|
| // |
| keywordKind[26] = (TK_print); |
| |
|
|
| //
|
| // Rule 27: KeyWord ::= p r i n t l n
|
| // |
| keywordKind[27] = (TK_println); |
| |
|
|
| //
|
| // Rule 28: KeyWord ::= l o g
|
| // |
| keywordKind[28] = (TK_log); |
| |
|
|
| //
|
| // Rule 29: KeyWord ::= d e b u g
|
| // |
| keywordKind[29] = (TK_debug); |
| |
|
|
| //
|
| // Rule 30: KeyWord ::= i n f o
|
| // |
| keywordKind[30] = (TK_info); |
| |
|
|
| //
|
| // Rule 31: KeyWord ::= w a r n i n g
|
| // |
| keywordKind[31] = (TK_warning); |
| |
|
|
| //
|
| // Rule 32: KeyWord ::= e r r o r
|
| // |
| keywordKind[32] = (TK_error); |
| |
|
|
| //
|
| // Rule 33: KeyWord ::= f a t a l
|
| // |
| keywordKind[33] = (TK_fatal); |
| |
|
|
| //
|
| // Rule 34: KeyWord ::= s e q
|
| // |
| keywordKind[34] = (TK_seq); |
| |
|
|
| //
|
| // Rule 35: KeyWord ::= s h a r e a b l e
|
| // |
| keywordKind[35] = (TK_shareable); |
| |
|
|
| //
|
| // Rule 36: KeyWord ::= p a r a l l e l
|
| // |
| keywordKind[36] = (TK_parallel); |
| |
|
|
| //
|
| // Rule 37: KeyWord ::= r a n d o m
|
| // |
| keywordKind[37] = (TK_random); |
| |
|
|
| //
|
| // Rule 38: KeyWord ::= l e t
|
| // |
| keywordKind[38] = (TK_let); |
| |
|
|
| //
|
| // Rule 39: KeyWord ::= i n
|
| // |
| keywordKind[39] = (TK_in); |
| |
|
|
| //
|
| // Rule 40: KeyWord ::= b e l o w
|
| // |
| keywordKind[40] = (TK_below); |
| |
|
|
| //
|
| // Rule 41: KeyWord ::= c h o o s e
|
| // |
| keywordKind[41] = (TK_choose); |
| |
|
|
| //
|
| // Rule 42: KeyWord ::= f o r a l l
|
| // |
| keywordKind[42] = (TK_forall); |
| |
|
|
| //
|
| // Rule 43: KeyWord ::= w i t h
|
| // |
| keywordKind[43] = (TK_with); |
| |
|
|
| //
|
| // Rule 44: KeyWord ::= d o
|
| // |
| keywordKind[44] = (TK_do); |
| |
|
|
| //
|
| // Rule 45: KeyWord ::= i t e r a t e
|
| // |
| keywordKind[45] = (TK_iterate); |
| |
|
|
| //
|
| // Rule 46: KeyWord ::= i f
|
| // |
| keywordKind[46] = (TK_if); |
| |
|
|
| //
|
| // Rule 47: KeyWord ::= t r y
|
| // |
| keywordKind[47] = (TK_try); |
| |
|
|
| //
|
| // Rule 48: KeyWord ::= e l s e
|
| // |
| keywordKind[48] = (TK_else); |
| |
|
|
| //
|
| // Rule 49: KeyWord ::= w h e n
|
| // |
| keywordKind[49] = (TK_when); |
| |
|
|
| //
|
| // Rule 50: KeyWord ::= c h a n g e d
|
| // |
| keywordKind[50] = (TK_changed); |
| |
|
|
| //
|
| // Rule 51: KeyWord ::= n e w
|
| // |
| keywordKind[51] = (TK_new); |
| |
|
|
| //
|
| // Rule 52: KeyWord ::= d e l e t e _ c o n t e n t
|
| // |
| keywordKind[52] = (TK_delete_content); |
| |
|
|
| //
|
| // Rule 53: KeyWord ::= m o v e _ c o n t e n t
|
| // |
| keywordKind[53] = (TK_move_content); |
| |
|
|
| //
|
| // Rule 54: KeyWord ::= s k i p _ b o u n d a r y _ e d g e s
|
| // |
| keywordKind[54] = (TK_skip_boundary_edges); |
| |
|
|
| //
|
| // Rule 55: KeyWord ::= c o p y _ b o u n d a r y _ e d g e s
|
| // |
| keywordKind[55] = (TK_copy_boundary_edges); |
| |
|
|
| //
|
| // Rule 56: KeyWord ::= s k i p
|
| // |
| keywordKind[56] = (TK_skip); |
| |
|
|
| //
|
| // Rule 57: KeyWord ::= d e l e t e
|
| // |
| keywordKind[57] = (TK_delete); |
| |
|
|
| //
|
| // Rule 58: KeyWord ::= c o p y
|
| // |
| keywordKind[58] = (TK_copy); |
| |
|
|
| //
|
| // Rule 59: KeyWord ::= m o v e
|
| // |
| keywordKind[59] = (TK_move); |
| |
|
|
| //
|
| // Rule 60: KeyWord ::= r e n a m e
|
| // |
| keywordKind[60] = (TK_rename); |
| |
|
|
| //
|
| // Rule 61: KeyWord ::= s e t V a l u e
|
| // |
| keywordKind[61] = (TK_setValue); |
| |
|
|
| //
|
| // Rule 62: KeyWord ::= s e t F r o m
|
| // |
| keywordKind[62] = (TK_setFrom); |
| |
|
|
| //
|
| // Rule 63: KeyWord ::= s e t T o
|
| // |
| keywordKind[63] = (TK_setTo); |
| |
|
|
| //
|
| // Rule 64: KeyWord ::= s e t M u l t i p l i c i t y
|
| // |
| keywordKind[64] = (TK_setMultiplicity); |
| |
|
|
| //
|
| // Rule 65: KeyWord ::= s e t A g g r e g a t i o n
|
| // |
| keywordKind[65] = (TK_setAggregation); |
| |
|
|
| //
|
| // Rule 66: KeyWord ::= s e t I n v e r s e
|
| // |
| keywordKind[66] = (TK_setInverse); |
| |
|
|
| //
|
| // Rule 67: KeyWord ::= u n d e f
|
| // |
| keywordKind[67] = (TK_undef); |
| |
|
|
| //
|
| // Rule 68: KeyWord ::= t r u e
|
| // |
| keywordKind[68] = (TK_true); |
| |
|
|
| //
|
| // Rule 69: KeyWord ::= f a l s e
|
| // |
| keywordKind[69] = (TK_false); |
| |
|
|
| //
|
| // Rule 70: KeyWord ::= o n e _ t o _ o n e
|
| // |
| keywordKind[70] = (TK_one_to_one); |
| |
|
|
| //
|
| // Rule 71: KeyWord ::= o n e _ t o _ m a n y
|
| // |
| keywordKind[71] = (TK_one_to_many); |
| |
|
|
| //
|
| // Rule 72: KeyWord ::= m a n y _ t o _ o n e
|
| // |
| keywordKind[72] = (TK_many_to_one); |
| |
|
|
| //
|
| // Rule 73: KeyWord ::= m a n y _ t o _ m a n y
|
| // |
| keywordKind[73] = (TK_many_to_many); |
| |
|
|
| //
|
| // Rule 74: KeyWord ::= v a l u e
|
| // |
| keywordKind[74] = (TK_value); |
| |
|
|
| //
|
| // Rule 75: KeyWord ::= n a m e
|
| // |
| keywordKind[75] = (TK_name); |
| |
|
|
| //
|
| // Rule 76: KeyWord ::= f q n
|
| // |
| keywordKind[76] = (TK_fqn); |
| |
|
|
| //
|
| // Rule 77: KeyWord ::= r e f
|
| // |
| keywordKind[77] = (TK_ref); |
| |
|
|
| //
|
| // Rule 78: KeyWord ::= s o u r c e
|
| // |
| keywordKind[78] = (TK_source); |
| |
|
|
| //
|
| // Rule 79: KeyWord ::= t a r g e t
|
| // |
| keywordKind[79] = (TK_target); |
| |
|
|
| //
|
| // Rule 80: KeyWord ::= m u l t i p l i c i t y
|
| // |
| keywordKind[80] = (TK_multiplicity); |
| |
|
|
| //
|
| // Rule 81: KeyWord ::= a g g r e g a t i o n
|
| // |
| keywordKind[81] = (TK_aggregation); |
| |
|
|
| //
|
| // Rule 82: KeyWord ::= i n v e r s e
|
| // |
| keywordKind[82] = (TK_inverse); |
| |
|
|
| //
|
| // Rule 83: KeyWord ::= t o S t r i n g
|
| // |
| keywordKind[83] = (TK_toString); |
| |
|
|
| //
|
| // Rule 84: KeyWord ::= t o I n t e g e r
|
| // |
| keywordKind[84] = (TK_toInteger); |
| |
|
|
| //
|
| // Rule 85: KeyWord ::= t o B o o l e a n
|
| // |
| keywordKind[85] = (TK_toBoolean); |
| |
|
|
| //
|
| // Rule 86: KeyWord ::= t o D o u b l e
|
| // |
| keywordKind[86] = (TK_toDouble); |
| |
|
|
| //
|
| // Rule 87: KeyWord ::= t o M u l t i p l i c i t y
|
| // |
| keywordKind[87] = (TK_toMultiplicity); |
| |
| |
|
|
| for (int i = 0; i < keywordKind.length; i++)
|
| {
|
| if (keywordKind[i] == 0)
|
| keywordKind[i] = identifierKind;
|
| }
|
| }
|
| }
|
| |