예제 #1
0
		//=========================================================================================
		internal StateParser(StateScanner scanner)
			: this()
		{
			this.Scanner = scanner;
			this.Spec = new ParserSpecification();
			this.Settings = new NonSyntaxSettings();
		}
예제 #2
0
		//=========================================================================================
		public SyntaxParser(SyntaxSettings settings, int tabsize)
		{
			this._TabSize = tabsize;
			this.Settings = settings;

			this.charMap = new LetterType[256];
			for (char c = '\0'; c < (char)256; c++)
			{
				if (char.IsWhiteSpace(c))
					this.charMap[c] = LetterType.WhiteSpace;
			}
			foreach (char c in this.Settings.Operators)
				this.charMap[c] = LetterType.Operator;

			this.QuotedTokenRules = new Dictionary<string, BoundedElement>();
			foreach (BaseElement oGroup in this.Settings.Elements)
			{
				BoundedElement oRealGroup = oGroup as BoundedElement;
				if (oRealGroup != null)
					this.QuotedTokenRules.Add(oRealGroup.StartSymbols, oRealGroup);
			}

			this.KeywordsMap = new Dictionary<string, TextStyle>(StringComparer.OrdinalIgnoreCase);
			foreach (BaseElement oRule in this.Settings.Elements)
			{
				if (oRule is FixedListElement)
				{
					foreach (string sKeyword in ((FixedListElement)oRule).Keywords)
						this.KeywordsMap.Add(sKeyword, oRule.Style);
				}
			}
		}
예제 #3
0
		//=========================================================================================
		public StateParser(SyntaxSettings settings, int tabsize)
			: this()
		{
			this.Settings = settings;
			ScannerSpecification oScannerSpec = this.Settings.CreateScannerSpecification();
			this.Scanner = new StateScanner(oScannerSpec, tabsize);
			this.Spec = this.Settings.CreateParserSpecification(oScannerSpec);
		}