diff options
author | Mike Buland <mike@xagasoft.com> | 2013-04-23 11:47:01 -0600 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2013-04-23 11:47:01 -0600 |
commit | 04f56c12e82ea5228b2b65e68c46ed7f4563182b (patch) | |
tree | 89a8db02dae8aaafd70f91bb15f21209cd1fa0ed /src/lexer.cpp | |
parent | 9f138260dafeb5a1b541fff8dd577422439feb0b (diff) | |
download | clic-04f56c12e82ea5228b2b65e68c46ed7f4563182b.tar.gz clic-04f56c12e82ea5228b2b65e68c46ed7f4563182b.tar.bz2 clic-04f56c12e82ea5228b2b65e68c46ed7f4563182b.tar.xz clic-04f56c12e82ea5228b2b65e68c46ed7f4563182b.zip |
Variables work.
Diffstat (limited to 'src/lexer.cpp')
-rw-r--r-- | src/lexer.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lexer.cpp b/src/lexer.cpp index 3ebb0cf..46686c8 100644 --- a/src/lexer.cpp +++ b/src/lexer.cpp | |||
@@ -63,6 +63,26 @@ Token Lexer::nextToken() | |||
63 | } | 63 | } |
64 | break; | 64 | break; |
65 | 65 | ||
66 | case '$': | ||
67 | { | ||
68 | Bu::String *sTmp = new Bu::String(); | ||
69 | for( iBufPos++; iBufPos < sBuf.getSize() && | ||
70 | sBuf[iBufPos] != ' ' && sBuf[iBufPos] != '\t' && | ||
71 | sBuf[iBufPos] != '+' && sBuf[iBufPos] != '-' && | ||
72 | sBuf[iBufPos] != '*' && sBuf[iBufPos] != '/' && | ||
73 | sBuf[iBufPos] != '(' && sBuf[iBufPos] != ')'; | ||
74 | iBufPos++ ) | ||
75 | { | ||
76 | sTmp->append( sBuf[iBufPos] ); | ||
77 | } | ||
78 | return Token( Token::tVariable, sTmp ); | ||
79 | } | ||
80 | break; | ||
81 | |||
82 | case '=': | ||
83 | iBufPos++; | ||
84 | return Token( Token::tEquals ); | ||
85 | |||
66 | case '+': | 86 | case '+': |
67 | iBufPos++; | 87 | iBufPos++; |
68 | return Token( Token::tPlus ); | 88 | return Token( Token::tPlus ); |
@@ -115,26 +135,6 @@ Token Lexer::nextToken() | |||
115 | delete sTmp; | 135 | delete sTmp; |
116 | return Token( Token::tNumber, n ); | 136 | return Token( Token::tNumber, n ); |
117 | } | 137 | } |
118 | else if( (sBuf[iBufPos]>=(ascRangeTop+1) && sBuf[iBufPos]<='z') || | ||
119 | (sBuf[iBufPos]>='A' && sBuf[iBufPos]<='Z') || | ||
120 | sBuf[iBufPos] == '_' ) | ||
121 | { | ||
122 | for( ; iBufPos < sBuf.getSize(); iBufPos++ ) | ||
123 | { | ||
124 | if( (sBuf[iBufPos]>='a' && sBuf[iBufPos]<='z') || | ||
125 | (sBuf[iBufPos]>='A' && sBuf[iBufPos]<='Z') || | ||
126 | (sBuf[iBufPos]>='0' && sBuf[iBufPos]<='9') || | ||
127 | sBuf[iBufPos] == '_' ) | ||
128 | { | ||
129 | sTmp->append( sBuf[iBufPos] ); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | break; | ||
134 | } | ||
135 | } | ||
136 | return Token( Token::tString, sTmp ); | ||
137 | } | ||
138 | else | 138 | else |
139 | { | 139 | { |
140 | sBuf.clear(); | 140 | sBuf.clear(); |