<> <> <<>> <> <<>> DIRECTORY MathDisplayExpr, Rope; Parser: CEDAR DEFINITIONS = BEGIN <> ROPE: TYPE ~ Rope.ROPE; DisplayExpr: TYPE ~ MathDisplayExpr.DisplayExpr; <> LexType: TYPE ~ {ucAlpha, lcAlpha, digit, decimalPoint, backSpace, singleCharTemplate, templateDelimiter, symbolDelimiter, other}; TokenType: TYPE ~ {integer, real, variable, template, symbol, none}; KbBuffer: TYPE ~ RECORD[type: TokenType _ none, data: ROPE, savedWrapArg: DisplayExpr _ NIL]; ParseAction: TYPE ~ REF ParseActionRep; ReplaceAction: TYPE ~ replace ParseActionRep; BeginMultiCharTemplateAction: TYPE ~ beginMultiCharTemplate ParseActionRep; FinishMultiCharTemplateAction: TYPE ~ finishMultiCharTemplate ParseActionRep; WrapAction: TYPE ~ wrap ParseActionRep; UndoAction: TYPE ~ undo ParseActionRep; NoAction: TYPE ~ none ParseActionRep; ParseActionRep: TYPE ~ RECORD [ SELECT type:* FROM beginMultiCharTemplate => [ oldSelect: ATOM -- old selection flavor which contains expr to be wrapped ], finishMultiCharTemplate => [ class: ATOM -- class for template wrapper ], replace => [ oldSelect: ATOM, -- old selection flavor which contains expr to replace construct: TokenType, -- new expression to be constructed fromRope: ROPE, -- data for construction newSelect: ATOM -- selection flavor to select as after replacement ], wrap => [ selection: ATOM, -- old selection flavor class: ATOM -- class for template wrapper ], undo => NULL, none => NULL -- nothing ENDCASE ]; <> LexChar: PROC[c: CHAR] RETURNS[LexType]; ParseKBChar: PUBLIC PROC[c: CHAR, inBuffer: KbBuffer, primaryActive, keyboardActive: BOOL _ FALSE] RETURNS [outBuffer: KbBuffer, action: ParseAction _ NIL]; END.