nescobjecttreebuilder.java

来自「plugin for eclipse」· Java 代码 · 共 2,529 行 · 第 1/5 页

JAVA
2,529
字号
			}
		}
		_retTree = _t;
		return configObj;
	}
	
	public final Module  module(AST _t) throws RecognitionException {
		Module moduleObj;
		
		TNode module_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode m = null;
		TNode i = null;
			moduleObj = null; 
																	List portList = null;
																	ModuleImplementation moduleImplObj = null;
																
		
		try {      // for error handling
			AST __t686 = _t;
			m = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NModule);
			_t = _t.getFirstChild();
			if ( inputState.guessing==0 ) {
					moduleObj = new Module();
																			moduleObj.setDefNode(m); 
																			ctx.setCurrentModule(moduleObj);
																		
			}
			i = (TNode)_t;
			match(_t,ID);
			_t = _t.getNextSibling();
			if ( inputState.guessing==0 ) {
					moduleObj.setNameNode(i);
					                									
			}
			portList=interfaceDescription(_t);
			_t = _retTree;
			if ( inputState.guessing==0 ) {
					moduleObj.addPortList(portList);
			}
			moduleImplObj=moduleImplementation(_t);
			_t = _retTree;
			if ( inputState.guessing==0 ) {
					moduleObj.setImplementation(moduleImplObj);
			}
			if ( inputState.guessing==0 ) {
					
																			// just to make sure that noone messes around with this module any more thinking that operating on the current module
																			ctx.setCurrentModule(null);
																		
			}
			_t = __t686;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return moduleObj;
	}
	
	public final List  interfaceDescription(AST _t) throws RecognitionException {
		List portList;
		
		TNode interfaceDescription_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode lc = null;
		TNode rc = null;
			portList = null;
																	List usesPortList;
																	List providesPortList;
																
		
		try {      // for error handling
			AST __t690 = _t;
			lc = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NInterfaceDescription);
			_t = _t.getFirstChild();
			if ( inputState.guessing==0 ) {
					portList = new ArrayList();
			}
			{
			_loop692:
			do {
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case NUses:
				{
					usesPortList=uses(_t);
					_t = _retTree;
					if ( inputState.guessing==0 ) {
							portList.addAll(usesPortList);
					}
					break;
				}
				case NProvides:
				{
					providesPortList=provides(_t);
					_t = _retTree;
					if ( inputState.guessing==0 ) {
							portList.addAll(providesPortList);
					}
					break;
				}
				default:
				{
					break _loop692;
				}
				}
			} while (true);
			}
			rc = (TNode)_t;
			match(_t,RCURLY);
			_t = _t.getNextSibling();
			_t = __t690;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return portList;
	}
	
	public final ModuleImplementation  moduleImplementation(AST _t) throws RecognitionException {
		ModuleImplementation implObj = null;
		
		TNode moduleImplementation_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode i = null;
		TNode lc = null;
		TNode d = null;
		TNode f = null;
		TNode rc = null;
		
																	List declnList = null;
																	Declaration declObj = null;
																	Scope scope = null;
																
		
		try {      // for error handling
			AST __t707 = _t;
			i = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NImplementation);
			_t = _t.getFirstChild();
			if ( inputState.guessing==0 ) {
					implObj = new ModuleImplementation();
																			implObj.setDefNode(i); 
																			scope = new Scope("module " + ctx.getCurrentModule().getName(), ctx.getCurrentScope());
																			ctx.pushScope(scope);
																			implObj.setScope(scope);
																		
			}
			lc = (TNode)_t;
			match(_t,LCURLY);
			_t = _t.getNextSibling();
			{
			int _cnt709=0;
			_loop709:
			do {
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case NDeclaration:
				{
					d = _t==ASTNULL ? null : (TNode)_t;
					declnList=declaration(_t);
					_t = _retTree;
					if ( inputState.guessing==0 ) {
							implObj.addDeclarations(declnList);
					}
					break;
				}
				case NFunctionDef:
				{
					f = _t==ASTNULL ? null : (TNode)_t;
					declObj=functionDef(_t);
					_t = _retTree;
					if ( inputState.guessing==0 ) {
							implObj.addDeclaration(declObj);
					}
					break;
				}
				case LITERAL_asm:
				{
					asm_expr(_t);
					_t = _retTree;
					break;
				}
				case SEMI:
				{
					TNode tmp5_AST_in = (TNode)_t;
					match(_t,SEMI);
					_t = _t.getNextSibling();
					break;
				}
				case NTypeMissing:
				{
					typelessDeclaration(_t);
					_t = _retTree;
					break;
				}
				case NText:
				{
					textNode(_t);
					_t = _retTree;
					break;
				}
				default:
				{
					if ( _cnt709>=1 ) { break _loop709; } else {throw new NoViableAltException(_t);}
				}
				}
				_cnt709++;
			} while (true);
			}
			rc = (TNode)_t;
			match(_t,RCURLY);
			_t = _t.getNextSibling();
			if ( inputState.guessing==0 ) {
					ctx.popScope();
			}
			_t = __t707;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return implObj;
	}
	
	public final void configurationImplementation(AST _t,
		Configuration configObj
	) throws RecognitionException {
		
		TNode configurationImplementation_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode i = null;
		TNode lc = null;
		TNode rc = null;
		
																	ConfigurationImplementation implObj = configObj.getImplementation();
																	implObj.setConfiguration(configObj);
																	List componentListObj = null;
																	List connectionListObj = null;
																
		
		try {      // for error handling
			AST __t711 = _t;
			i = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NImplementation);
			_t = _t.getFirstChild();
			if ( inputState.guessing==0 ) {
					implObj.setDefNode(i);
																		
			}
			lc = (TNode)_t;
			match(_t,LCURLY);
			_t = _t.getNextSibling();
			{
			_loop713:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==NComponentList)) {
					componentListObj=componentList(_t);
					_t = _retTree;
					if ( inputState.guessing==0 ) {
							implObj.addComponents(componentListObj);
					}
				}
				else {
					break _loop713;
				}
				
			} while (true);
			}
			connectionListObj=connectionList(_t,configObj);
			_t = _retTree;
			if ( inputState.guessing==0 ) {
					implObj.addConnections(connectionListObj);
			}
			rc = (TNode)_t;
			match(_t,RCURLY);
			_t = _t.getNextSibling();
			_t = __t711;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
	}
	
	public final List  uses(AST _t) throws RecognitionException {
		List portList;
		
		TNode uses_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode u = null;
			portList = null;
		
		try {      // for error handling
			AST __t694 = _t;
			u = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NUses);
			_t = _t.getFirstChild();
			portList=interfaceDescriptionItemList(_t,Port.Direction.USES);
			_t = _retTree;
			_t = __t694;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return portList;
	}
	
	public final List  provides(AST _t) throws RecognitionException {
		List portList;
		
		TNode provides_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode p = null;
			portList = null;
		
		try {      // for error handling
			AST __t696 = _t;
			p = _t==ASTNULL ? null :(TNode)_t;
			match(_t,NProvides);
			_t = _t.getFirstChild();
			portList=interfaceDescriptionItemList(_t,Port.Direction.PROVIDES);
			_t = _retTree;
			_t = __t696;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return portList;
	}
	
	public final List  interfaceDescriptionItemList(AST _t,
		int direction
	) throws RecognitionException {
		List portList;
		
		TNode interfaceDescriptionItemList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode lc = null;
		TNode rc = null;
			portList = new ArrayList(); 
																	Port portObj = null;
																
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case NDeclaration:
			case LITERAL_interface:
			{
				portObj=interfaceDescriptionItem(_t,direction);
				_t = _retTree;
				if ( inputState.guessing==0 ) {
						portList.add(portObj);
				}
				break;
			}
			case LCURLY:
			{
				{
				lc = (TNode)_t;
				match(_t,LCURLY);
				_t = _t.getNextSibling();
				{
				int _cnt700=0;
				_loop700:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_t.getType()==NDeclaration||_t.getType()==LITERAL_interface)) {
						portObj=interfaceDescriptionItem(_t,direction);
						_t = _retTree;
						if ( inputState.guessing==0 ) {
								portList.add(portObj);
						}
					}
					else {
						if ( _cnt700>=1 ) { break _loop700; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt700++;
				} while (true);
				}
				rc = (TNode)_t;
				match(_t,RCURLY);
				_t = _t.getNextSibling();
				}
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			if (inputState.guessing==0) {
				reportError(ex);
				if (_t!=null) {_t = _t.getNextSibling();}
			} else {
			  throw ex;
			}
		}
		_retTree = _t;
		return portList;
	}
	
	public final Port  interfaceDescriptionItem(AST _t,
		int direction
	) throws RecognitionException {
		Port portObj = null;
		
		TNode interfaceDescriptionItem_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
		TNode i = null;
		TNode id = null;
		TNode alias = null;
		
																	InterfacePort ipObj = null;
																	FunctionPort fpObj = null;
																	List decls = null;
																	// InterfaceAlias interfaceAliasObj = null;
																	Interface interfaceObj = null;
																	ParameterTypeList ptlObj = null;
																	NesCInterfaceFile interfaceFileObj = null;
																
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case NDeclaration:
			{
				decls=declaration(_t);
				_t = _retTree;
				if ( inputState.guessing==0 ) {
					
																				fpObj = new FunctionPort(ctx);
																				portObj = fpObj;
																				fpObj.setDirection(direction);
																				fpObj.setDeclaration((Declaration)decls.get(0));
																			
				}
				break;
			}
			case LITERAL_interface:
			{
				i = (TNode)_t;
				match(_t,LITERAL_interface);
				_t = _t.getNextSibling();
				AST __t702 = _t;
				id = _t==ASTNULL ? null :(TNode)_t;
				match(_t,ID);
				_t = _t.getFirstChild();
				if ( inputState.guessing==0 ) {
					
							 													ipObj = new InterfacePort(ctx);
							 													portObj = ipObj;
							 													ipObj.setDirection(direction);
							 													ipObj.setNameNode(id);
							 												
				}
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case LITERAL_as:
				{
					TNode tmp6_AST_in = (TNode)_t;
					match(_t,LITERAL_as);
					_t = _t.getNextSibling();
					alias = (TNode)_t;
					match(_t,ID);
					_t = _t.getNextSibling();

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?