From d7eceebe0eb9cd7840f183dcaf294c85794b0db5 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 3 Jun 2012 13:02:47 +0000 Subject: * interp/lexing.boot (%Line): Now a record structure. * boot/parser.boot (bpTypeName): Split out of bpTypeAliasDefinition. (bpStruct): Use it. Support parameterized structures. * boot/ast.boot (ctorName): New. (bfEnum): Use it for parameterized enums. (bfRecord): Use it for parameterized records. --- src/interp/lexing.boot | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/interp') diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot index 426e1fbc..09fbd7d5 100644 --- a/src/interp/lexing.boot +++ b/src/interp/lexing.boot @@ -47,28 +47,20 @@ module lexing where --% --% Line abstract datatype ---% structure Line == ---% Record(buffer: String, curChar: Character, ---% curIdx: SingleInteger, lstIdx: SingleInteger, lineNo: SingleInteger) --% -makeLine(buf == makeString 0, ch == charByName "Return", - curIdx == 1, lstIdx == 0, no == 0) == - [buf,ch,curIdx,lstIdx,no] - -macro lineBuffer l == - first l - -macro lineCurrentChar l == - second l +structure %Line == + Record(buf: %String, cchar: %Char, cidx: %Short, + lidx: %Short, no: %Short) with + lineBuffer == (.buf) -- input string buffer + lineCurrentChar == (.cchar) -- current character + lineCurrentIndex == (.cidx) -- current index + lineLastIndex == (.lidx) -- last valid index + lineNumber == (.no) -- line number -macro lineCurrentIndex l == - third l -macro lineLastIndex l == - fourth l - -macro lineNumber l == - fifth l +makeLine(buf == makeString 0, ch == charByName "Return", + curIdx == 1, lstIdx == 0, no == 0) == + mk%Line(buf,ch,curIdx,lstIdx,no) lineClear! l == lineBuffer(l) := makeString 0 -- cgit v1.2.3