lexer.h
1 #ifndef __pll_LEXER__
2 #define __pll_LEXER__
3 
4 #define PLL_ASCII_SIZE 128
5 #define PLL_EOS 0x00000200
6 
7 #define PLL_SYM_CR 1 << 0
8 #define PLL_SYM_LF 1 << 1
9 #define PLL_SYM_LFCR 1 << 2
10 #define PLL_SYM_DIGIT 1 << 3
11 #define PLL_SYM_CHAR 1 << 4
12 #define PLL_SYM_SPACE 1 << 5
13 #define PLL_SYM_TAB 1 << 6
14 #define PLL_SYM_EOF 1 << 7
15 #define PLL_SYM_UNKNOWN 1 << 8
16 #define PLL_SYM_DOT 1 << 9
17 #define PLL_SYM_COLON 1 << 10
18 #define PLL_SYM_OPAREN 1 << 11
19 #define PLL_SYM_CPAREN 1 << 12
20 #define PLL_SYM_COMMA 1 << 13
21 #define PLL_SYM_SEMICOLON 1 << 14
22 #define PLL_SYM_EQUAL 1 << 15
23 #define PLL_SYM_DASH 1 << 16
24 #define PLL_SYM_SLASH 1 << 17
25 #define PLL_SYM_PLUS 1 << 18
26 
27 #define PLL_TOKEN_NUMBER 1 << 0
28 #define PLL_TOKEN_STRING 1 << 1
29 #define PLL_TOKEN_EOF 1 << 2
30 #define PLL_TOKEN_WHITESPACE 1 << 3
31 #define PLL_TOKEN_NEWLINE 1 << 4
32 #define PLL_TOKEN_UNKNOWN 1 << 5
33 #define PLL_TOKEN_COLON 1 << 6
34 #define PLL_TOKEN_OPAREN 1 << 7
35 #define PLL_TOKEN_CPAREN 1 << 8
36 #define PLL_TOKEN_FLOAT 1 << 9
37 #define PLL_TOKEN_COMMA 1 << 10
38 #define PLL_TOKEN_SEMICOLON 1 << 11
39 #define PLL_TOKEN_EQUAL 1 << 12
40 #define PLL_TOKEN_DASH 1 << 13
41 #define PLL_TOKEN_SLASH 1 << 14
42 
43 #define CONSUME(x) while (token.tokenType & (x)) token = get_token (&input);
44 #define NEXT_TOKEN token = get_token (&input);
45 
46 typedef struct
47  {
48  int tokenType;
49  const char * lexeme;
50  int len;
51  } pllLexToken;
52 
53 int get_next_byte (void);
54 int get_next_symbol (void);
55 pllLexToken get_token (int * input);
56 void init_lexan (const char * text, long n);
57 void lex_table_amend_phylip (void);
58 void lex_table_amend_fasta (void);
59 void lex_table_restore (void);
60 #endif
Definition: lexer.h:46