protected override void RuleDidSucceed(object result, StringParserState.Element stateAtStart, StringParserState.Element stateAtEnd) { // Apply DebugMetadata based on the state at the start of the rule // (i.e. use line number as it was at the start of the rule) var parsedObj = result as Parsed.Object; if (parsedObj) { var md = new Runtime.DebugMetadata(); md.startLineNumber = stateAtStart.lineIndex + 1; md.endLineNumber = stateAtEnd.lineIndex + 1; md.fileName = _filename; parsedObj.debugMetadata = md; return; } // A list of objects that doesn't already have metadata? var parsedListObjs = result as List <Parsed.Object>; if (parsedListObjs != null) { foreach (var parsedListObj in parsedListObjs) { if (!parsedListObj.hasOwnDebugMetadata) { var md = new Runtime.DebugMetadata(); md.startLineNumber = stateAtStart.lineIndex + 1; md.endLineNumber = stateAtEnd.lineIndex + 1; md.fileName = _filename; parsedListObj.debugMetadata = md; } } } }
protected override void RuleDidSucceed(object result, StringParserState.Element stateAtStart, StringParserState.Element stateAtEnd) { // Apply DebugMetadata based on the state at the start of the rule // (i.e. use line number as it was at the start of the rule) var parsedObj = result as Parsed.Object; if (parsedObj) { parsedObj.debugMetadata = CreateDebugMetadata(stateAtStart, stateAtEnd); return; } // A list of objects that doesn't already have metadata? var parsedListObjs = result as List <Parsed.Object>; if (parsedListObjs != null) { foreach (var parsedListObj in parsedListObjs) { if (!parsedListObj.hasOwnDebugMetadata) { parsedListObj.debugMetadata = CreateDebugMetadata(stateAtStart, stateAtEnd); } } } var id = result as Parsed.Identifier; if (id != null) { id.debugMetadata = CreateDebugMetadata(stateAtStart, stateAtEnd); } }
protected Runtime.DebugMetadata CreateDebugMetadata(StringParserState.Element stateAtStart, StringParserState.Element stateAtEnd) { var md = new Runtime.DebugMetadata(); md.startLineNumber = stateAtStart.lineIndex + 1; md.endLineNumber = stateAtEnd.lineIndex + 1; md.startCharacterNumber = stateAtStart.characterInLineIndex + 1; md.endCharacterNumber = stateAtEnd.characterInLineIndex + 1; md.fileName = _filename; return(md); }
protected override void RuleDidSucceed(object result, StringParserState.Element stateAtStart, StringParserState.Element stateAtEnd) { // Apply DebugMetadata based on the state at the start of the rule // (i.e. use line number as it was at the start of the rule) var parsedObj = result as Parsed.Object; if (parsedObj) { var md = new Runtime.DebugMetadata(); md.startLineNumber = stateAtStart.lineIndex + 1; md.endLineNumber = stateAtEnd.lineIndex + 1; md.fileName = _filename; parsedObj.debugMetadata = md; } }
protected virtual void RuleDidSucceed(object result, StringParserState.Element startState, StringParserState.Element endState) { }