Mercurial > hg > index.cgi
comparison lwbasic/lexer.c @ 26:26aa76da75ad
Additional parsing in function/sub; emission of prolog/epilog code
author | lost@l-w.ca |
---|---|
date | Thu, 27 Jan 2011 20:44:57 -0700 |
parents | 87590f43e76d |
children | 574931d87abd |
comparison
equal
deleted
inserted
replaced
25:87590f43e76d | 26:26aa76da75ad |
---|---|
53 { "public", token_kw_public }, | 53 { "public", token_kw_public }, |
54 { "private", token_kw_private }, | 54 { "private", token_kw_private }, |
55 { "as", token_kw_as }, | 55 { "as", token_kw_as }, |
56 { "params", token_kw_params }, | 56 { "params", token_kw_params }, |
57 { "returns", token_kw_returns }, | 57 { "returns", token_kw_returns }, |
58 { "integer", token_kw_integer }, | |
59 { "endsub", token_kw_endsub }, | |
60 { "endfunction", token_kw_endfunction }, | |
58 { NULL } | 61 { NULL } |
59 }; | 62 }; |
60 | 63 |
61 static int lexer_getchar(cstate *state) | 64 static int lexer_getchar(cstate *state) |
62 { | 65 { |
109 int c; | 112 int c; |
110 struct token_list *tok = NULL; | 113 struct token_list *tok = NULL; |
111 | 114 |
112 for (;;) { | 115 for (;;) { |
113 c = lexer_curchar(state); | 116 c = lexer_curchar(state); |
114 if (c == '_' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c >= 0x80) | 117 if (c == '_' || (c >= '0' && c <= '9' ) || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c >= 0x80) |
115 { | 118 { |
116 /* character is part of word */ | 119 /* character is part of word */ |
117 if (wordpos >= wordlen) | 120 if (wordpos >= wordlen) |
118 { | 121 { |
119 word = lw_realloc(word, wordlen + 32); | 122 word = lw_realloc(word, wordlen + 32); |