ISToken.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
edit by Ayers 22-May-85 17:17:01
Rick Beach, August 1, 1985 2:48:08 pm PDT
MKaplan, September 13, 1985 2:41:44 pm PDT
DIRECTORY
ISBinding USING [StackHandle],
ISNode USING [Handle],
ViewerClasses,
Rope,
IO;
ISToken: CEDAR DEFINITIONS
= BEGIN
Token types.
TVType: TYPE = {
null, endOfString, endOfStream, endOfScript,
integer, atom, string, dollar, characters,
plus, minus, times, divide, gets, open,
leftCurly, rightCurly, node, push, pop,
specialChars, styleOpen, styleDefinition };
'TV' is for Token(or)Value
TVObject: TYPE = RECORD [
next: TVHandle ← NIL,
streamName: ATOMNIL,
body: SELECT type: TVType FROM
null => [], endOfString => [], endOfStream => [], endOfScript => [],
integer => [value: LONG INTEGER ← 0],
atom => [value: ATOMNIL],
string => [list: TVHandle ← NIL, tail: TVHandle ← NIL],
dollar => [value: ATOMNIL],
characters => [stream: IO.STREAM, startIndex, length: INT],
plus => [], minus => [], times => [], divide => [], gets => [],
open => [],
leftCurly => [], rightCurly => [],
push => [], pop => [],
node => [isnode: --ISNode.Handle-- REFNIL],
specialChars => [value: Rope.ROPENIL, font: INTEGER ← 0],
styleOpen => [name: ATOMNIL],
styleDefinition => [name: ATOMNIL, value: TVHandle ← NIL],
ENDCASENULL ];
TVHandle: TYPE = REF TVObject;
NodeTVHandle: TYPE = REF node TVObject;
DollarTVHandle: TYPE = REF dollar TVObject;
AtomTVHandle: TYPE = REF atom TVObject;
StyleOpenTVHandle: TYPE = REF styleOpen TVObject;
StyleDefinitionTVHandle: TYPE = REF styleDefinition TVObject;
GetsTVHandle: TYPE = REF gets TVObject;
IntegerTVHandle: TYPE = REF integer TVObject;
MinusTVHandle: TYPE = REF minus TVObject;
PlusTVHandle: TYPE = REF plus TVObject;
TimesTVHandle: TYPE = REF times TVObject;
DivideTVHandle: TYPE = REF divide TVObject;
OpenTVHandle: TYPE = REF open TVObject;
CharactersTVHandle: TYPE = REF characters TVObject;
StringTVHandle: TYPE = REF string TVObject;
PushTVHandle: TYPE = REF push TVObject;
PopTVHandle: TYPE = REF pop TVObject;
NullTVHandle: TYPE = REF null TVObject;
EOSmTVHandle: TYPE = REF endOfStream TVObject;
EOSgTVHandle: TYPE = REF endOfString TVObject;
EOScTVHandle: TYPE = REF endOfScript TVObject;
LeftCurlyTVHandle: TYPE = REF leftCurly TVObject;
RightCurlyTVHandle: TYPE = REF rightCurly TVObject;
Moved here from ISNode.mesa.
Contexts used to pass information from the parser and the back end ("implementation"). Each phase of parsing a node has its own context: initial, before anything in the node is processed, content and embedded, for contents of the node (embedded for subnodes, content for primitive objects), end for finishing up once all contents and bindings have been incorporated into the node, and bindings for doing any tag-specific processing with bindings. (Bindings are saved in the node by the ISScan.CollectNode, and a bindings context is passed to the implementation (in ISTiogaInternImpl) for each tag in the node.
Sequencing: TYPE = {
initial, content, styleOpen, styleDefinition, embedded, bindings, end};
InterscriptContext: TYPE = REF InterscriptContextObject;
InterscriptContextObject: TYPE = RECORD [
body: SELECT sequencing: Sequencing FROM
initial => [parent: --ISNode.Handle-- REF],
content => [content: TVHandle],
styleOpen => [identifier: StyleOpenTVHandle],
styleDefinition => [definition: StyleDefinitionTVHandle],
embedded => [content: NodeTVHandle],
bindings => [bindings: --ISBinding.StackHandle-- REF],
end => [],
ENDCASE ];
InitialInterscriptContext: TYPE = REF initial InterscriptContextObject;
ContentInterscriptContext: TYPE = REF content InterscriptContextObject;
StyleOpenInterscriptContext: TYPE = REF styleOpen InterscriptContextObject;
StyleDefinitionInterscriptContext: TYPE = REF styleDefinition InterscriptContextObject;
EmbeddedInterscriptContext: TYPE = REF embedded InterscriptContextObject;
BindingsInterscriptContext: TYPE = REF bindings InterscriptContextObject;
EndInterscriptContext: TYPE = REF end InterscriptContextObject;
END.