public static IFunctionStream CreateFunctionStream(LookAheadLangParser parser, string filename, bool suppressMethodSignatures) { if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts")) return new JSParser(parser); return new CCCParser(parser, suppressMethodSignatures); }
public FileAnalyzer(StreamReader filestream, ICCMNotify callback, object context, bool suppressMethodSignatures, string filename, ParserSwitchBehavior switchBehavior = ParserSwitchBehavior.TraditionalInclude) { this.buffer = new CharBuffer(filestream.BaseStream.Length); this.buffer.ReadEntireStream(filestream); var processStream = new StreamReader(buffer.GetBytesMemoryStream()); // run through preprocessor before setting up parser... Preprocessor preprocessor = new Preprocessor(processStream); StreamReader stream = preprocessor.Process(); // this construct should be fixed and support OCP if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts")) { this.parser = LookAheadLangParser.CreateJavascriptParser(stream); } else { this.parser = LookAheadLangParser.CreateCppParser(stream); } this.callback = callback; this.context = context; this.suppressMethodSignatures = suppressMethodSignatures; this.filename = filename; this.switchBehavior = switchBehavior; }
public FileAnalyzer(StreamReader filestream, ICCMNotify callback, object context, bool suppressMethodSignatures, string filename) { this.buffer = new char[filestream.BaseStream.Length]; filestream.Read(this.buffer, 0, this.buffer.Length); var processStream = new StreamReader(new MemoryStream(Encoding.Default.GetBytes(this.buffer))); // run through preprocessor before setting up parser... Preprocessor preprocessor = new Preprocessor(processStream); StreamReader stream = preprocessor.Process(); // this construct should be fixed and support OCP if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts")) { this.parser = LookAheadLangParser.CreateJavascriptParser(stream); } else { this.parser = LookAheadLangParser.CreateCppParser(stream); } this.callback = callback; this.context = context; this.suppressMethodSignatures = suppressMethodSignatures; this.filename = filename; }
public static IFunctionStream CreateFunctionStream(LookAheadLangParser parser, string filename, bool suppressMethodSignatures) { if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts")) { return(new JSParser(parser)); } return(new CCCParser(parser, suppressMethodSignatures)); }
private static bool NextIsCommentBlock(LookAheadLangParser parser) { if (parser.PeekNextKeyword(0).Equals("/") && ( parser.PeekNextKeyword(1).Equals("/") || parser.PeekNextKeyword(1).Equals("*"))) { return(true); } return(false); }
public static bool NextIsIfndef(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { string directive = Preprocessor.GetDirective(parser); if (directive.Equals("ifndef")) return true; } return false; }
public BlockAnalyzer(LookAheadLangParser parser, IFunctionStream functionStream = null, OnLocalFunctionDelegate onLocalFunctionDelegate = null) { this.parser = parser; this.conditionalsWithExpressions = new List <string>( new string[] { "if", "while", "foreach", "for", "else if", }); this.branchPointKeywords = new List <string>( new string[] { "case", "catch" }); this.functionStream = functionStream; this.onLocalFunctionDelegate = onLocalFunctionDelegate; }
public static bool NextIsEndif(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { if (parser.PeekNextKeyword(1).Equals("endif") || parser.PeekNextKeyword(1).Equals("end")) { return true; } } return false; }
public static bool NextIsEndif(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { if (parser.PeekNextKeyword(1).Equals("endif") || parser.PeekNextKeyword(1).Equals("end")) { return(true); } } return(false); }
public void ConsumeIfDef(LookAheadLangParser parser) { Debug.Assert(Preprocessor.NextIsIfdef(parser)); while (!(parser.PeekNextKeyword().Equals("if") || parser.PeekNextKeyword().Equals("ifdef") || parser.PeekNextKeyword().Equals("def"))) { ConumseNextKeyWordSpaceOutput(); } ConumseNextKeyWordSpaceOutput(); }
public static bool NextIsElse(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { string directive = Preprocessor.GetDirective(parser); if (directive.Equals("else")) { return(true); } } return(false); }
public BlockAnalyzer(LookAheadLangParser parser, IFunctionStream functionStream = null, OnLocalFunctionDelegate onLocalFunctionDelegate = null, ParserSwitchBehavior switchBehavior = ParserSwitchBehavior.TraditionalInclude) { this.parser = parser; this.conditionalsWithExpressions = new List<string>( new string[] { "if", "while", "foreach", "for", "else if", }); this.branchPointKeywords = new List<string>(new string[] { "catch" }); if (switchBehavior == ParserSwitchBehavior.TraditionalInclude) this.branchPointKeywords.Add("case"); this.functionStream = functionStream; this.onLocalFunctionDelegate = onLocalFunctionDelegate; }
private static string GetDirective(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { int offset = 1; while (parser.PeekNextKeyword(offset).Equals(" ")) { offset++; } return(parser.PeekNextKeyword(offset)); } throw new UnknownStructureException("Internal pre processor error."); }
public void ConsumeIfndef(LookAheadLangParser parser) { Debug.Assert(Preprocessor.NextIsIfndef(parser)); while (true) { if (parser.PeekNextKeyword().Equals("ifndef")) { break; } ConumseNextKeyWordSpaceOutput(); } ConumseNextKeyWordSpaceOutput(); }
public BlockAnalyzer(LookAheadLangParser parser, IFunctionStream functionStream = null, OnLocalFunctionDelegate onLocalFunctionDelegate = null, ParserSwitchBehavior switchBehavior = ParserSwitchBehavior.TraditionalInclude) { this.parser = parser; this.conditionalsWithExpressions = new List <string>( new string[] { "if", "while", "foreach", "for", "else if", }); this.branchPointKeywords = new List <string>(new string[] { "catch" }); if (switchBehavior == ParserSwitchBehavior.TraditionalInclude) { this.branchPointKeywords.Add("case"); } this.functionStream = functionStream; this.onLocalFunctionDelegate = onLocalFunctionDelegate; }
public FileAnalyzer(StreamReader filestream, ICCMNotify callback, object context, bool suppressMethodSignatures, string filename, ParserSwitchBehavior switchBehavior = ParserSwitchBehavior.TraditionalInclude) { this.buffer = new char[filestream.BaseStream.Length]; filestream.Read(this.buffer, 0, this.buffer.Length); var processStream = new StreamReader(new MemoryStream(Encoding.Default.GetBytes(this.buffer))); // run through preprocessor before setting up parser... Preprocessor preprocessor = new Preprocessor(processStream); StreamReader stream = preprocessor.Process(); // this construct should be fixed and support OCP if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts")) this.parser = LookAheadLangParser.CreateJavascriptParser(stream); else this.parser = LookAheadLangParser.CreateCppParser(stream); this.callback = callback; this.context = context; this.suppressMethodSignatures = suppressMethodSignatures; this.filename = filename; this.switchBehavior = switchBehavior; }
public Preprocessor(StreamReader inputStream) { LookAheadTokenParser tokenParser = new LookAheadTokenParser(inputStream, Preprocessor.tokens, false); this.parser = new LookAheadLangParser(tokenParser); }
private static string GetDirective(LookAheadLangParser parser) { if (parser.PeekNextKeyword().Equals("#")) { int offset = 1; while (parser.PeekNextKeyword(offset).Equals(" ")) offset++; return parser.PeekNextKeyword(offset); } throw new UnknownStructureException("Internal pre processor error."); }
private static bool NextIsCommentBlock(LookAheadLangParser parser) { if (parser.PeekNextKeyword(0).Equals("/") && ( parser.PeekNextKeyword(1).Equals("/") || parser.PeekNextKeyword(1).Equals("*"))) return true; return false; }
public JSParser(LookAheadLangParser parser) { this.parser = parser; }
public TestContext(LookAheadLangParser parser, CCCParser ccc) { this.parser = parser; this.ccc = ccc; }
public CCCParser(LookAheadLangParser parser, bool suppressSignature) { this.parser = parser; this.suppressSignature = suppressSignature; }