Class OperatorDeclarationForm

java.lang.Object
org.ek9lang.compiler.repair.OperatorDeclarationForm
All Implemented Interfaces:
TextRule

final class OperatorDeclarationForm extends Object implements TextRule
An operator declaration written in another order than the grammar's [override|default] operator <symbol> [as] [pure] [abstract] (operatorDeclaration). Three shapes, each with one reading:
  • operator $ override as pure - the override moved to the front;
  • operator$() / operator $() - an operator is declared without parentheses;
  • default operator default operator ? - the duplicated prefix dropped.
Only a symbol the compiler's OperatorMap knows is treated as an operator.
  • Constructor Details

    • OperatorDeclarationForm

      OperatorDeclarationForm()
  • Method Details

    • apply

      public TextRule.Rewrite apply(List<String> lines, SyntaxProbe.SyntaxError failure)
      Description copied from interface: TextRule
      The rewrite of lines answering failure, or null.
      Specified by:
      apply in interface TextRule
      Parameters:
      lines - the source's lines (never modified by a rule - a rewrite carries its own copy)
      failure - the first syntax error, as the parser reported it