public CodePart Compile(ParseTree tree, Context context, CompilerOptions options) { _part = new CodePart(); _context = context; _options = options; try { if (tree.Nodes.Count > 0) { PreProcess(tree); CompileProgram(tree); } } catch (Exception e) { if (_lastNode != null) { throw new Exception(string.Format("Error parsing {0}: {1}", ConcatenateNodes(_lastNode), e.Message)); } else { throw; } } return _part; }
private void LoadContext(string contextId) { if (contextId != string.Empty) { if (contexts.ContainsKey(contextId)) { currentContext = contexts[contextId]; } else { currentContext = new Context(); contexts.Add(contextId, currentContext); } } else { currentContext = new Context(); } }