bug 515242: finish FE support for actor types specified to be in "any" state (by adding State.ANY). fix IPDL handling of carriage return, remove them from new code

This commit is contained in:
Chris Jones 2009-09-09 01:58:08 -05:00
Родитель e86ce2971e
Коммит ec9d2c6dbc
7 изменённых файлов: 163 добавлений и 148 удалений

Просмотреть файл

@ -331,6 +331,9 @@ class State(Node):
def __repr__(self): return '<State %r start=%r>'% (self.name, self.start)
def __str__(self): return '<State %s start=%s>'% (self.name, self.start)
State.ANY = State(Loc.NONE, '[any]', start=True)
State.NONE = State(Loc.NONE, '[none]', start=False)
class Param(Node):
def __init__(self, loc, typespec, name):
Node.__init__(self, loc)

Просмотреть файл

@ -186,7 +186,7 @@ def t_multilinecomment(t):
t.lexer.lineno += t.value.count('\n')
def t_NL(t):
r'\n+'
r'(?:\r\n|\n|\n)+'
t.lexer.lineno += len(t.value)
def t_ID(t):

Просмотреть файл

@ -32,7 +32,7 @@
import os, sys
from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, TypeSpec, UsingStmt, Visitor, ASYNC, SYNC, RPC, IN, OUT, INOUT, ANSWER, CALL, RECV, SEND
from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, State, TypeSpec, UsingStmt, Visitor, ASYNC, SYNC, RPC, IN, OUT, INOUT, ANSWER, CALL, RECV, SEND
import ipdl.builtin as builtin
class Type:
@ -487,6 +487,11 @@ class GatherDecls(TcheckVisitor):
type=StateType(trans.state.start),
progname=trans.state.name)
# declare implicit "any" state
self.declare(loc=State.ANY.loc,
type=StateType(start=False),
progname=State.ANY.name)
for trans in p.transitionStmts:
self.seentriggers = set()
trans.accept(self)
@ -494,6 +499,13 @@ class GatherDecls(TcheckVisitor):
# visit the message decls once more and resolve the state names
# attached to actor params and returns
def resolvestate(param):
if param.type.state is None:
# we thought this was a C++ type until type checking,
# when we realized it was an IPDL actor type. But
# that means that the actor wasn't specified to be in
# any particular state
param.type.state = State.ANY
loc = param.loc
statename = param.type.state.name
statedecl = self.symtab.lookup(statename)