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

Ohm-JS fails to complain about (some) missing semantic actions #443

Open
guitarvydas opened this issue Mar 13, 2023 · 0 comments
Open

Ohm-JS fails to complain about (some) missing semantic actions #443

guitarvydas opened this issue Mar 13, 2023 · 0 comments

Comments

@guitarvydas
Copy link

// Ohm-JS fails to complain about missing semantic actions - the ones that are commented out.

// If you delete "s2" from the formals of rexpr_general, Ohm-JS complains (correctly) about the arity mismatch.

var ohm = require ('ohm-js')

const grammar = ohm.grammar (
`
C2CL0 {

top = oneCharOrRexpr+

oneCharOrRexpr =
| space -- space
| &"(" rexpr -- rexpr
| any -- other

rexpr =
| pattern spaces -- pattern
| "(" spaces rexpr* ")" spaces -- general
| verbatim spaces -- verbatim
| atom spaces -- bottom

pattern = ~any any any any
verbatim = ~any any any any
atom = ~any any any any
}
`);

const semantics = grammar.createSemantics ().addOperation ("junk", {
top (x) {},
//oneCharOrRexpr_space (x) {},
//oneCharOrRexpr_rexpr (la, x) {},
//oneCharOrRexpr_other (x) {},
//rexpr_pattern (x, s) {},
rexpr_general (lp, s, rs, rp, s2) {},
//rexpr_verbatim (x, s) {},
//rexpr_bottom (x, s) {},
_terminal () {}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant