/[classpath]/gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by julian, Fri Dec 10 15:16:32 2004 UTC revision 1.16 by julian, Mon Dec 13 17:39:51 2004 UTC
# Line 197  import gnu.classpath.tools.NotifyingInpu Line 197  import gnu.classpath.tools.NotifyingInpu
197           final int STATE_NORMAL=1;           final int STATE_NORMAL=1;
198           final int STATE_SLASHC=2;           final int STATE_SLASHC=2;
199           final int STATE_STARC=3;           final int STATE_STARC=3;
200             final int STATE_FIELDVAL=4;
201             final int STATE_STRING=5;
202             final int STATE_SINGLEQUOTED=6;
203    
204           int state=STATE_NORMAL;           int state=STATE_NORMAL;
205             int prevState=STATE_NORMAL;
206    
207             int fieldValueLevel = 0;
208    
209           for (; index<source.length && !isField; ++index) {           for (; index<source.length && !isField; ++index) {
210              if (state==STATE_STARC) {              if (state==STATE_STARC) {
211                 if (index<source.length-1 && source[index]=='*' && source[index+1]=='/') {                 if (index<source.length-1 && source[index]=='*' && source[index+1]=='/') {
212                    ++index;                    ++index;
213                    state=STATE_NORMAL;                    state=prevState;
214                 }                 }
215              }              }
216              else if (state==STATE_SLASHC) {              else if (state==STATE_SLASHC) {
217                 if (source[index]=='\n') {                 if (source[index]=='\n') {
218                    state=STATE_NORMAL;                    state=prevState;
219                   }
220                }
221                else if (state==STATE_STRING) {
222                   if (source[index]=='\"') {
223                      state=prevState;
224                   }
225                }
226                else if (state==STATE_SINGLEQUOTED) {
227                   if (source[index]=='\'') {
228                      state=prevState;
229                 }                 }
230              }              }
231                else if (state==STATE_FIELDVAL) {
232                   if (source[index]=='/') {
233                      if (index<source.length-1 && source[index+1]=='*') {
234                         state=STATE_STARC;
235                         ++index;
236                      }
237                      else if (index<source.length-1 && source[index+1]=='/') {
238                         state=STATE_SLASHC;
239                         ++index;
240                      }
241                   }
242                   else if (source[index]=='{') {
243                      ++ fieldValueLevel;
244                   }
245                   else if (source[index]=='}') {
246                      -- fieldValueLevel;
247                   }
248                   else if (source[index]=='\"') {
249                      state=STATE_STRING;
250                   }
251                   else if (source[index]=='\'') {
252                      state=STATE_SINGLEQUOTED;
253                   }
254                   else if (source[index]==';' && 0 == fieldValueLevel) {
255                      isField=true;
256                      break;
257                   }
258                }
259              else switch (source[index]) {              else switch (source[index]) {
260              case '/':              case '/':
261                 if (index<source.length-1 && source[index+1]=='*') {                 if (index<source.length-1 && source[index+1]=='*') {
# Line 227  import gnu.classpath.tools.NotifyingInpu Line 271  import gnu.classpath.tools.NotifyingInpu
271              case '(':  // method              case '(':  // method
272                 return -1;                 return -1;
273              case '=':  // field              case '=':  // field
274                   state=STATE_FIELDVAL;
275                   prevState=state;
276                   continue;
277              case ';':  // field              case ';':  // field
278                 isField=true;                 isField=true;
279                 break;                 break;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26