package lrgrep
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Detailed error messages for Menhir-generated parsers
Install
dune-project
Dependency
Authors
Maintainers
Sources
lrgrep-0.9.tbz
sha256=e53de12e4c5cbe6bca00643593266b4f9fa2e3f6a138195eeff7a4329f5c1c75
sha512=7fd7c4d11506fea7cc11c9bbf5aea9142d905643553c0c90e1bb16b794106b0c14a266acf89ae91b6929008dc0ba6515f788642873e2e4ba6c3d49bd45d25127
doc/kernel/Kernel/Spec/index.html
Module Kernel.SpecSource
Specification interface
This module exports the data structures that represent the user's error specification after parsing and resolution.
Type definitions:
- ('g, 'r) clause: A group of patterns sharing the same action (one clause in the grammar)
- ('g, 'r) branch: A single pattern within a clause
- clause_def: Additional metadata about a clause, mainly for handling %shortest groups:
shortest: Is the clause in a %shortest groupnew_group: Is the clause the first of the group? If true, it starts a new priority group.
- ('g, 'r) clauses: All clauses in a rule:
definitions: The clause definition for each clausecaptures: The captured variables for each clause
- ('g, 'r) branches: All branches across all clauses:
clause,pattern,expr: Branch properties. Pattern is the abstract syntax of the pattern being recognized, while expr is a lower-level representation of the pattern as a regular expression.of_clause: Mapping from clauses to their brancheslookaheads: Optional lookahead constraints per branchbr_captures: Captured variables per branchis_total,is_partial: Whether branches are total/partialpriority: Priorities determine which branch should match when multiple branches succeed. Text order is used most of the time (first branch matches first), except for a %shortest group, in which case the branch that matches the first has the priority.
- 'g _rule: A rule with all its clauses and branches
Main functions:
branch_count: Return the number of branchesimport_rule: Compile a Syntax.rule into the internal specification
Implementation details:
- The priority system allows specification of multiple clauses with different precedence. Later clauses have lower priority.
- The
is_total/is_partialdistinction matters for coverage analysis: partial clauses only accept specific lookaheads, total clauses accept any lookahead.
- The
import_rulefunction handles various clause types: - Normal clauses (total)
- Partial clauses with specific lookahead constraints
- %shortest groups where all clauses share priority
TODO: "Unreachable" clauses are not implemented at the moment.
Source
type ('g, 'r) clauses = {definitions : (('g, 'r) clause, clause_def) Fix.Indexing.vector;captures : (('g, 'r) clause, (Regexp.Capture.n, Syntax.capture_kind * string) Utils.Misc.indexmap) Fix.Indexing.vector;
}Source
type ('g, 'r) branches = {clause : (('g, 'r) branch, ('g, 'r) clause Fix.Indexing.index) Fix.Indexing.vector;pattern : (('g, 'r) branch, Syntax.pattern) Fix.Indexing.vector;expr : (('g, 'r) branch, 'g Regexp.Expr.t) Fix.Indexing.vector;of_clause : (('g, 'r) clause, ('g, 'r) branch Utils.Misc.indexset) Fix.Indexing.vector;lookaheads : (('g, 'r) branch, 'g Info.terminal Utils.Misc.indexset option) Fix.Indexing.vector;br_captures : (('g, 'r) branch, Regexp.Capture.n Utils.Misc.indexset) Fix.Indexing.vector;is_total : ('g, 'r) branch Utils.Boolvector.t;is_partial : ('g, 'r) branch Utils.Boolvector.t;priority : (('g, 'r) branch, ('g, 'r) branch Fix.Indexing.opt Fix.Indexing.index) Fix.Indexing.vector;
}Source
val import_rule :
'g Info.grammar ->
'g Redgraph.graph ->
'g Transl.Indices.t ->
'g Redgraph.target_trie ->
Syntax.rule ->
'g _rule sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>