コード例 #1
0
 public void parse(PsiBuilder builder) {
   final PsiBuilder.Marker root = builder.mark();
   PsiBuilder.Marker error = null;
   while (!builder.eof()) {
     final String token = builder.getTokenText();
     if ("?".equals(token)) error = builder.mark();
     builder.advanceLexer();
     if (error != null) {
       error.error("test error 2");
       error = null;
     }
   }
   root.done(this);
 }
コード例 #2
0
 public void parse(PsiBuilder builder) {
   final PsiBuilder.Marker root = builder.mark();
   PsiBuilder.Marker nested = null;
   while (!builder.eof()) {
     final String token = builder.getTokenText();
     if ("[".equals(token) && nested == null) {
       nested = builder.mark();
     }
     builder.advanceLexer();
     if ("]".equals(token) && nested != null) {
       nested.collapse(myCHAMELEON_2);
       nested.precede().done(OTHER);
       nested = null;
       builder.error("test error 1");
     }
   }
   if (nested != null) nested.drop();
   root.done(this);
 }