grammar-dead-condition

A condition tag that holds for no release, dialect, or feature.

Group
Urscal grammars
Runs
On by default
Level
warning
Reads
Every file
Fix
None: whether to correct the tags or remove the construct is the author's choice

Why

The condition tags on a construct, together with those around it, hold for no release, dialect, or set of features the catalog declares, so no parse can use the construct. Correct the tags or remove the construct.

The fix, as Ur suggests it: correct the condition tags, or remove the construct.

For agents

Give each construct condition tags that, with those around it, hold for some release, dialect, or set of features.

Example

calc/Calc.rsc
module calc::Calc

track Calc = "1" "2" "3";
dialect Standard uses Calc;
profile "calc-1" = Standard Calc "1";
profile "calc-2" = Standard Calc "2";
profile "calc-3" = Standard Calc "3";

lexical Name = [a-z]+ \ Reserved;
lexical Number = [0-9]+;
layout Space = [\  \n]+;
keyword Reserved = "let" | "print";

start syntax Program = Program: Statement* statements;
syntax Statement
  = Let: "let" Name name "=" Expr value
  | @since="3" @before="2" Print: "print" Expr value;
syntax Expr = Variable: Name name | Literal: Number number;
What Ur prints
$ ur lint --rule grammar-dead-condition
warning[grammar-dead-condition]: the alternative `Print` of `Statement` is never active: its conditions hold for no release, dialect, or feature the catalog declares
  --> ./calc/Calc.rsc:17:5 the condition that never holds
  = hint: correct the condition tags, or remove the construct
  = see: Feature Consistency in Compile-Time-Configurable System Software, Reinhard Tartler, Daniel Lohmann, Julio Sincero, and Wolfgang Schröder-Preikschat, EuroSys 2011 (2011-04), http://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
0 clone classes and 1 grammar finding in 1 file

Try it in the playground →

Source

Feature Consistency in Compile-Time-Configurable System Software, Reinhard Tartler, Daniel Lohmann, Julio Sincero, and Wolfgang Schröder-Preikschat, EuroSys 2011 (2011-04).