Class ParametersInParentheses

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

final class ParametersInParentheses extends Object implements TextRule
Parameters declared the way other languages declare them (was ParameterDeclarations.inParentheses): add(name as String) / label(first: String, last: String) - Java's parameter list on a DECLARATION line. EK9's parentheses on a declaration are always empty, so the parser stops on the first parameter expecting ) - which also proves the line is a declaration, not a call (a call with named arguments parses). The parameters move under ->, one per line. CommaSeparatedParameters is the other such rule.
  • Constructor Details

    • ParametersInParentheses

      ParametersInParentheses()
  • Method Details

    • apply

      public TextRule.Rewrite apply(List<String> lines, SyntaxProbe.SyntaxError failure)
      add(name as String) as pure - the parameters moved under ->, the parentheses left empty.
      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