antlr / antlr/antlr4

Fixed position parsing - Lexing by character position in line.

Open
#883 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

It would be useful to be able to express character position constraints in a pure ANTLR grammar (without predicate actions).

Example:
I have lexical rules such as:
PS_BEGIN: {getCharPositionInLine()==23}? [bB];

Thanks for considering it. I understand it may be a specialized case, and should stay implemented as is. Just thought I'd suggest it

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or implementation entry points. Start by reviewing how lexical rules and predicate actions are handled in ANTLR grammars; done would be a pure grammar way to express character-position constraints such as position 23 without predicate actions.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.