MessageSplitter

class MessageSplitter constructor(messageName: A_String)

MessageSplitter is used to split Avail message names into a sequence of instructions that can be used directly for parsing.

Message splitting occurs in two phases. In the first setPhase, the message is tokenized and parsed into an abstract Expression tree. In the second setPhase, a tuple type of phrase types is supplied, and produces a tuple of integer-encoded ParsingOperations.

Author

Mark van Gulik

Todd L Smith

Parameters

messageName

An Avail string specifying the keywords and arguments of some message being defined.

Throws

    If the message name is malformed.

Constructors

Link copied to clipboard
fun MessageSplitter(messageName: A_String)

Construct a new MessageSplitter, parsing the provided message into token strings and generating parsing for parsing occurrences of this message.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
enum Metacharacter : Enum<MessageSplitter.Metacharacter>

The metacharacters used in message names.

Functions

Link copied to clipboard
fun checkImplementationSignature(functionType: A_Type, sectionNumber: Int = Integer.MAX_VALUE)

Check that an implementation with the given signature is appropriate for a message like this.

Link copied to clipboard
fun checkListStructure(list: A_Phrase): Boolean

Answer whether the given list is correctly internally structured for a send of this message. It must recursively match the expected number of arguments, as well as have the expected permutations in the corresponding recursive Expressions.

Link copied to clipboard
fun highlightedNameFor(phraseType: A_Type, pc: Int): String

Answer a String containing the message name with an indicator inserted to show which area of the message is being parsed by the given program counter.

Link copied to clipboard
fun instructionsTupleFor(phraseType: A_Type): A_Tuple

Answer a tuple of Avail integers describing how to parse this message. See MessageSplitter and ParsingOperation for an understanding of the parse instructions.

Link copied to clipboard
fun printSendNodeOnIndent(    sendPhrase: A_Phrase,     builder: StringBuilder,     indent: Int)

Pretty-print a send of this message with given argument phrases.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val containsGroups: Boolean

Does the message contain any groups?

Link copied to clipboard
val leafArgumentCount: Int = 0

The number of underscores/ellipses present in the method name. This is not the same as the number of arguments that a method implementing this name would accept, as a top-level guillemet group with N recursively embedded underscores/ellipses is counted as N, not one.

Link copied to clipboard
val messageName: A_String

The Avail string to be parsed.

Link copied to clipboard
val messageParts: Array<A_String>

The individual tokens (strings) constituting the message.

Link copied to clipboard
val numberOfArguments: Int

Return the number of arguments a MethodDefinitionDescriptor implementing this name would accept. Note that this is not necessarily the number of underscores and ellipses, as a guillemet group may contain zero or more underscores/ellipses (and other guillemet groups) but count as one top-level argument.

Link copied to clipboard
var numberOfSectionCheckpoints: Int = 0

The number of SectionCheckpoints encountered so far.

Link copied to clipboard
val recursivelyContainsReorders: Boolean

Answer whether there are any reordered expressions anywhere inside this method name. Reordering is specified by placing circled numbers (e.g., ①, ②) after all argument-yielding Expressions occurring in some Sequence. Either none or all must be numbered within any sequence, and the numbers must be a non-identity permutation (not simply ①, ②, ③, etc.).