Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: basic support preprocessors in hw parser #2280

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public StageResult<ParserStageResult> run(AnalysisContext context, StageResult<D
ParserListener listener = new ParserListener(context.getExtendedDocument(), context.getCopybooksRepository());
CobolErrorStrategy errorStrategy = new CobolErrorStrategy(messageService);
AstBuilder parser = ParserUtils.isHwParserEnabled()
? new SplitParser(CharStreams.fromString(context.getExtendedDocument().toString().replace('\u200B', ' ')),
? new SplitParser(CharStreams.fromString(context.getExtendedDocument().toString()),
listener, errorStrategy, treeListener)
: new AntlrCobolParser(CharStreams.fromString(context.getExtendedDocument().toString()),
listener, errorStrategy, treeListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void paragraph() {
private void statement() {
ctx.push(new Statement());
try {
while (!match(".") && ctx.getLexer().hasMore()) {
while (!match(".") && !isNextDivisionEofOrEop() && !isParagraph() && !isSection() && !isEndOfProgram()) {
consume();
}
optional(".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private ProcedureDivisionBodyContext createProcedureDivisionBodyContext(Procedur

if (node instanceof Statement) {
assureParagraphsCtx(genStack, pdbCtx, node);
ParserRuleContext s = parseStatement((Statement) node);
ParserRuleContext s = parseSentence((Statement) node);
lastToken = (CommonToken) s.stop;
s.setParent(genStack.peek());
genStack.peek().addChild(s);
Expand Down Expand Up @@ -199,7 +199,7 @@ private void handleSectionNode(LinkedList<ParserRuleContext> genStack, CstNode n
genStack.push(paragraphsContext);
}

private ParserRuleContext parseStatement(Statement node) {
private ParserRuleContext parseSentence(Statement node) {
Token startToken = findStartToken(node).get();
String input = generatePrefix(charStream, startToken) + node.toText();
CobolProcedureDivisionLexer antlrLexer =
Expand Down
Loading