Packages

case class Syntax extends Product with Serializable

Specifies the arguments accepted by a primitive. Used by the compiler for type-checking.

You cannot instantiate this class directly. Instead, use the static construction methods Syntax.commandSyntax(...) or Syntax.reporterSyntax(...).

For example, in a Reporter that takes two number arguments and returns a boolean, implement Primitive.getSyntax() as follows:

public Syntax getSyntax() {
  return Syntax.reporterSyntax(
    new int[] { Syntax.NumberType(), Syntax.NumberType() },
    Syntax.BooleanType());
}

An input can be made variadic, meaning that it can be repeated any number of times when enclosed in parentheses, if you add the RepeatableType flag. When using variadic inputs you should also define the default number of inputs, that is, the number of inputs expect if the user does not use parentheses. For example:

 public Syntax getSyntax() {
   return Syntax.reporterSyntax(
     new int[] { Syntax.WildcardType() | Syntax.RepeatableType() },
     Syntax.ListType(), 2);
 }

Source
Syntax.scala
See also

Primitive#getSyntax()

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Syntax
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. val agentClassString: String
  2. val blockAgentClassString: Option[String]
  3. val defaultOption: Option[Int]
  4. def dfault: Int
  5. def dump: String
  6. val introducesContext: Boolean
  7. def isInfix: Boolean

    indicates whether this instruction should be parsed as infix.

    indicates whether this instruction should be parsed as infix. Infix instructions expect exactly one argument on the left and should not be variadic on the right.

    returns

    true if this instruction is infix, false otherwise.

  8. val isRightAssociative: Boolean
  9. def isVariadic: Boolean

    determines whether an instruction allows a variable number of args.

  10. val left: Int
  11. def minimum: Int
  12. val minimumOption: Option[Int]
  13. val precedence: Int
  14. val ret: Int
  15. val right: List[Int]
  16. def rightDefault: Int

    returns the number of args this instruction takes on the right by default.

  17. def takesOptionalCommandBlock: Boolean
  18. def totalDefault: Int

    returns the total number of args, left and right, this instruction takes by default.