当前位置: 首页>>代码示例>>C#>>正文


C# Coco.State类代码示例

本文整理汇总了C#中at.jku.ssw.Coco.State的典型用法代码示例。如果您正苦于以下问题:C# State类的具体用法?C# State怎么用?C# State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


State类属于at.jku.ssw.Coco命名空间,在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MeltWith

	public void MeltWith(State s) { // copy actions of s to state
		for (Action action = s.firstAction; action != null; action = action.next) {
			Action a = new Action(action.typ, action.sym, action.tc);
			a.AddTargets(action);
			AddAction(a);
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:7,代码来源:DFA.cs

示例2: ScannerOutput

	public ScannerOutput(StreamWriter gen, Tab tab, bool ignoreCase, bool hasCtxMoves, State firstState, Comment firstComment) {
	    this.gen=gen;
	    this.tab=tab;
	    this.ignoreCase=ignoreCase;
	    this.hasCtxMoves=hasCtxMoves;
	    this.firstState=firstState;
	    this.firstComment=firstComment;
   	    keywords.Add("-->namespace",GenNamespace());
	    keywords.Add("-->declarations",GenDeclarations());
	    keywords.Add("-->initialization",GenInitialization());
	    keywords.Add("-->casing1",GenCasing1());
	    keywords.Add("-->casing2",GenCasing2());
	    keywords.Add("-->comments",GenComments());
	    keywords.Add("-->literals",GenLiterals());
        keywords.Add("-->scan3", GenScan3());
        keywords.Add("-->scan1",GenScan1());
	    keywords.Add("-->scan2",GenScan2());
	    keywords.Add("$$$",GenDollarDollarDollar());
	}
开发者ID:blucz,项目名称:coco-r-fsharp,代码行数:19,代码来源:ScannerOutput.cs

示例3: DFA

 public DFA(Parser parser)
 {
     this.parser = parser;
     tab = parser.tab;
     errors = parser.errors;
     trace = parser.trace;
     firstState = null; lastState = null; lastStateNr = -1;
     firstState = NewState();
     firstMelted = null; firstComment = null;
     ignoreCase = false;
     dirtyDFA = false;
     hasCtxMoves = false;
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:13,代码来源:DFA.cs

示例4: Step

 void Step(State from, Node p, BitArray stepped)
 {
     if (p == null) return;
     stepped[p.n] = true;
     switch (p.typ) {
     case Node.clas: case Node.chr: {
         NewTransition(from, TheState(p.next), p.typ, p.val, p.code);
         break;
     }
     case Node.alt: {
         Step(from, p.sub, stepped); Step(from, p.down, stepped);
         break;
     }
     case Node.iter: {
         if (Tab.DelSubGraph(p.sub)) {
             parser.SemErr("contents of {...} must not be deletable");
             return;
         }
         if (p.next != null && !stepped[p.next.n]) Step(from, p.next, stepped);
         Step(from, p.sub, stepped);
         if (p.state != from) {
             Step(p.state, p, new BitArray(tab.nodes.Count));
         }
         break;
     }
     case Node.opt: {
         if (p.next != null && !stepped[p.next.n]) Step(from, p.next, stepped);
         Step(from, p.sub, stepped);
         break;
     }
     }
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:32,代码来源:DFA.cs

示例5: NumberNodes

 // Assigns a state n.state to every node n. There will be a transition from
 // n.state to n.next.state triggered by n.val. All nodes in an alternative
 // chain are represented by the same state.
 // Numbering scheme:
 //  - any node after a chr, clas, opt, or alt, must get a new number
 //  - if a nested structure starts with an iteration the iter node must get a new number
 //  - if an iteration follows an iteration, it must get a new number
 void NumberNodes(Node p, State state, bool renumIter)
 {
     if (p == null) return;
     if (p.state != null) return; // already visited;
     if (state == null || (p.typ == Node.iter && renumIter)) state = NewState();
     p.state = state;
     if (Tab.DelGraph(p)) state.endOf = curSy;
     switch (p.typ) {
     case Node.clas: case Node.chr: {
         NumberNodes(p.next, null, false);
         break;
     }
     case Node.opt: {
         NumberNodes(p.next, null, false);
         NumberNodes(p.sub, state, true);
         break;
     }
     case Node.iter: {
         NumberNodes(p.next, state, true);
         NumberNodes(p.sub, state, true);
         break;
     }
     case Node.alt: {
         NumberNodes(p.next, null, false);
         NumberNodes(p.sub, state, true);
         NumberNodes(p.down, state, renumIter);
         break;
     }
     }
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:37,代码来源:DFA.cs

示例6: NewState

 //---------- State handling
 State NewState()
 {
     State s = new State(); s.nr = ++lastStateNr;
     if (firstState == null) firstState = s; else lastState.next = s;
     lastState = s;
     return s;
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:8,代码来源:DFA.cs

示例7: MeltStates

 void MeltStates(State state)
 {
     bool ctx;
     BitArray targets;
     Symbol endOf;
     for (Action action = state.firstAction; action != null; action = action.next) {
     if (action.target.next != null) {
         GetTargetStates(action, out targets, out endOf, out ctx);
         Melted melt = StateWithSet(targets);
         if (melt == null) {
             State s = NewState(); s.endOf = endOf; s.ctx = ctx;
             for (Target targ = action.target; targ != null; targ = targ.next)
                 s.MeltWith(targ.state);
             MakeUnique(s);
             melt = NewMelted(targets, s);
         }
         action.target.next = null;
         action.target.state = melt.state;
     }
     }
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:21,代码来源:DFA.cs

示例8: FindUsedStates

 void FindUsedStates(State state, BitArray used)
 {
     if (used[state.nr]) return;
     used[state.nr] = true;
     for (Action a = state.firstAction; a != null; a = a.next)
     FindUsedStates(a.target.state, used);
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:7,代码来源:DFA.cs

示例9: NewTransition

	void NewTransition(State from, State to, int typ, int sym, int tc) {
		if (to == firstState) parser.SemErr("token must not start with an iteration");
		Target t = new Target(to);
		Action a = new Action(typ, sym, tc); a.target = t;
		from.AddAction(a);
		if (typ == Node.clas) curSy.tokenKind = Symbol.classToken;
	}
开发者ID:SealedSun,项目名称:prx,代码行数:7,代码来源:DFA.cs

示例10: Init

	public static void Init (string dir) {
		srcDir = dir;
		firstState = null; lastState = null; State.lastNr = -1;
		firstState = NewState();
		Melted.first = null; Comment.first = null;
		dirtyDFA = false;
		hasCtxMoves = false;
	}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:DFA.cs

示例11: WriteState

	static void WriteState(State state) {
		Symbol endOf = state.endOf;
		gen.WriteLine("\t\t\tcase {0}:", state.nr);
		bool ctxEnd = state.ctx;
		for (Action action = state.firstAction; action != null; action = action.next) {
			if (action == state.firstAction) gen.Write("\t\t\t\tif (");
			else gen.Write("\t\t\t\telse if (");
			if (action.typ == Node.chr) gen.Write(ChCond((char)action.sym));
			else PutRange(CharClass.Set(action.sym));
			gen.Write(") {");
			if (action.tc == Node.contextTrans) {
				gen.Write("apx++; "); ctxEnd = false;
			} else if (state.ctx)
				gen.Write("apx = 0; ");
			gen.Write("buf.Append(ch); NextCh(); goto case {0};", action.target.state.nr);
			gen.WriteLine("}");
		}
		if (state.firstAction == null)
			gen.Write("\t\t\t\t{");
		else
			gen.Write("\t\t\t\telse {");
		if (ctxEnd) { // final context state: cut appendix
			gen.WriteLine();
			gen.WriteLine("\t\t\t\t\tbuf.Length = buf.Length - apx;");
			gen.WriteLine("\t\t\t\t\tpos = pos - apx - 1; line = t.line;");
			gen.WriteLine("\t\t\t\t\tBuffer.Pos = pos+1; NextCh();");
			gen.Write(  	"\t\t\t\t\t");
		}
		if (endOf == null) {
			gen.WriteLine("t.kind = noSym; goto done;}");
		} else {
			gen.Write("t.kind = {0}; ", endOf.n);
			if (endOf.tokenKind == Symbol.classLitToken) {
				gen.WriteLine("t.val = buf.ToString(); CheckLiteral(); return t;}");
			} else {
				gen.WriteLine("goto done;}");
			}
		}
	}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:39,代码来源:DFA.cs

示例12: NewTransition

	static void NewTransition(State from, State to, int typ, int sym, int tc) {
		if (to == firstState) Parser.SemErr("token must not start with an iteration");
		Target t = new Target(to);
		Action a = new Action(typ, sym, tc); a.target = t;
		from.AddAction(a);
	}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:6,代码来源:DFA.cs

示例13: NewState

	//---------- State handling
	static State NewState() {
		State s = new State();
		if (firstState == null) firstState = s; else lastState.next = s;
		lastState = s;
		return s;
	}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:DFA.cs

示例14: Melted

	public Melted(BitArray set, State state) {
		this.set = set; this.state = state;
		this.next = first; first = this;
	}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:4,代码来源:DFA.cs

示例15: FindAction

 //---------------------------- actions --------------------------------
 public Action FindAction(State state, char ch)
 {
     for (Action a = state.firstAction; a != null; a = a.next)
     if (a.typ == Node.chr && ch == a.sym) return a;
     else if (a.typ == Node.clas) {
         CharSet s = tab.CharClassSet(a.sym);
         if (s[ch]) return a;
     }
     return null;
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:11,代码来源:DFA.cs


注:本文中的at.jku.ssw.Coco.State类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。