public boolean parse(BashPsiBuilder builder) { /* Grammar: WHILE compound_list DO compound_list DONE UNTIL compound_list DO compound_list DONE */ final PsiBuilder.Marker loop = builder.mark(); builder.advanceLexer(); if (!Parsing.list.parseCompoundList(builder, false)) { loop.drop(); return false; } if (!ParserUtil.checkNextOrError( builder, ShellCommandParsing.DO_KEYWORD, "parser.shell.expectedDo", loop)) { return false; } if (!Parsing.list.parseCompoundList(builder, true)) { loop.drop(); return false; } if (!ParserUtil.checkNextOrError( builder, ShellCommandParsing.DONE_KEYWORD, "parser.shell.expectedDone", loop)) { return false; } loop.done(commandMarker); return true; }
public boolean isValid(BashPsiBuilder builder) { return builder.getTokenType() == startToken; }