コード例 #1
0
        internal Interpreter(InterpreterOption opt = InterpreterOption.Normal)
        {
            SubStatementAllowanceCollection.Init();

            Option = opt;
            InterpreterStatusStack.Push(typeof(Interpreter));
            TokenCreator.Init();
        }
コード例 #2
0
        /// <summary>
        /// Runs the interpreter on the given string and sets the root variable of this class as expected
        /// </summary>
        /// <param name="InputStr"></param>
        /// <param name="IsPath"></param>
        private YangInterpreterTool(string InputStr, bool IsPath, InterpreterOption opt)
        {
            string YangAsRawText;

            if (!IsPath)
            {
                YangAsRawText = InputStr;
            }
            else
            {
                YangAsRawText = File.ReadAllText(InputStr);
            }
            Interpreter.Interpreter interpreter = new Interpreter.Interpreter(opt);
            Root = interpreter.ConvertText(YangAsRawText) as ModuleStatement;
        }
コード例 #3
0
 /// <summary>
 /// Loads the yang file from file.
 /// </summary>
 /// <param name="Path">Path to the yang file.</param>
 /// <returns>Returns a YangInterpreterTool object with the loaded yang file.</returns>
 public static YangInterpreterTool Load(string Path, InterpreterOption opt = InterpreterOption.Normal)
 {
     return(new YangInterpreterTool(Path, true, opt));
 }
コード例 #4
0
 /// <summary>
 /// Parses the yang file from the given text.
 /// </summary>
 /// <param name="YangAsRawText">Text as which is equal to a valid yang file.</param>
 /// <returns>Returns a YangInterpreterTool object with the loaded yang file.</returns>
 public static YangInterpreterTool Parse(string YangAsRawText, InterpreterOption opt = InterpreterOption.Normal)
 {
     return(new YangInterpreterTool(YangAsRawText, false, opt));
 }