コード例 #1
0
 //=========================================================================================
 internal StateParser(StateScanner scanner)
     : this()
 {
     this.Scanner  = scanner;
     this.Spec     = new ParserSpecification();
     this.Settings = new NonSyntaxSettings();
 }
コード例 #2
0
ファイル: StateParser.cs プロジェクト: ygavrishov/SA.CodeView
		//=========================================================================================
		internal StateParser(StateScanner scanner)
			: this()
		{
			this.Scanner = scanner;
			this.Spec = new ParserSpecification();
			this.Settings = new NonSyntaxSettings();
		}
コード例 #3
0
ファイル: StateParser.cs プロジェクト: ygavrishov/SA.CodeView
		//=========================================================================================
		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);
		}
コード例 #4
0
		//=========================================================================================
		internal override ParserSpecification CreateParserSpecification(ScannerSpecification scannerSpecification)
		{
			var oSpec = new ParserSpecification();
			oSpec.AddRule("Tag", "lt?separator? id?tagName? {id?attribute? eq?separator? attrValue?attributeValue?} gt?separator?");
			oSpec.AddRule("Comment", "comment?comments?");
			oSpec.AddRule("Cdata", "cdata?cdata?");
			return oSpec;
		}
コード例 #5
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);
        }
コード例 #6
0
		//=========================================================================================
		internal virtual ParserSpecification CreateParserSpecification(ScannerSpecification scannerSpecification)
		{
			///Создание спецификации для парсера ПО УМОЛЧАНИЮ.
			///По умолчанию все правила состоят из одного токена.
			var oSpec = new ParserSpecification();

			Dictionary<string, string> ruleNames = new Dictionary<string, string>();
			///Найдем все упоминающиеся имена токенов и включим
			foreach (var oState in scannerSpecification.States)
			{
				string sTokenName = oState.ResultTokenName;
				if (!string.IsNullOrEmpty(sTokenName) && !ruleNames.ContainsKey(sTokenName))
				{
					oSpec.AddRule(sTokenName, sTokenName);
					ruleNames.Add(sTokenName, sTokenName);
				}
			}
			return oSpec;
		}
コード例 #7
0
ファイル: StateParser.cs プロジェクト: ygavrishov/SA.CodeView
		//=========================================================================================
		private StateParser()
		{
			this.Errors = new List<string>();
			this.TokenPool = new Queue<Token>();
			this.Spec = new ParserSpecification();
		}
コード例 #8
0
 //=========================================================================================
 private StateParser()
 {
     this.Errors    = new List <string>();
     this.TokenPool = new Queue <Token>();
     this.Spec      = new ParserSpecification();
 }