SetLanguageVersion() публичный Метод

public SetLanguageVersion ( int languageVersion ) : void
languageVersion int
Результат void
Пример #1
0
		/// <summary>
		/// Asserts that the value returned by
		/// <see cref="Rhino.Ast.AstNode.ToSource()">Rhino.Ast.AstNode.ToSource()</see>
		/// after
		/// the given input source was parsed equals the specified expected output source.
		/// </summary>
		/// <param name="source">the JavaScript source to be parsed</param>
		/// <param name="expectedOutput">
		/// the JavaScript source that is expected to be
		/// returned by
		/// <see cref="Rhino.Ast.AstNode.ToSource()">Rhino.Ast.AstNode.ToSource()</see>
		/// </param>
		private void AssertSource(string source, string expectedOutput)
		{
			CompilerEnvirons env = new CompilerEnvirons();
			env.SetLanguageVersion(Context.VERSION_1_7);
			Parser parser = new Parser(env);
			AstRoot root = parser.Parse(source, null, 0);
			NUnit.Framework.Assert.AreEqual(expectedOutput, root.ToSource());
		}
Пример #2
0
		/// <summary>
		/// Returns a
		/// <code>CompilerEnvirons</code>
		/// suitable for using Rhino
		/// in an IDE environment.  Most features are enabled by default.
		/// The
		/// <see cref="ErrorReporter">ErrorReporter</see>
		/// is set to an
		/// <see cref="Rhino.Ast.ErrorCollector">Rhino.Ast.ErrorCollector</see>
		/// .
		/// </summary>
		public static Rhino.CompilerEnvirons IdeEnvirons()
		{
			Rhino.CompilerEnvirons env = new Rhino.CompilerEnvirons();
			env.SetRecoverFromErrors(true);
			env.SetRecordingComments(true);
			env.SetStrictMode(true);
			env.SetWarnTrailingComma(true);
			env.SetLanguageVersion(170);
			env.SetReservedKeywordAsIdentifier(true);
			env.SetIdeMode(true);
			env.SetErrorReporter(new ErrorCollector());
			return env;
		}