@@ -1265,10 +1265,10 @@ public static List<Script> preprocess(TokenStream tokenStream,
12651265 * Compiles the token stream into a valid ParseTree. This also includes optimization and reduction.
12661266 *
12671267 * @param stream The token stream, as generated by {@link #lex(String, Environment, File, boolean) lex}
1268- * @param environment If an environment is already set up, it can be passed in here. The code will tolerate a null
1268+ * @param env If an environment is already set up, it can be passed in here. The code will tolerate a null
12691269 * value, but if present, should be passed in. If the value is null, a standalone environment will be generated
12701270 * and used.
1271- * @param envs The environments that are going to be present at runtime. Even if the {@code environment } parameter
1271+ * @param envs The environments that are going to be present at runtime. Even if the {@code env } parameter
12721272 * is null, this still must be non-null and populated with one or more values.
12731273 * @return A fully compiled, optimized, and reduced parse tree. If {@code stream} is null or empty, null is
12741274 * returned.
@@ -1278,20 +1278,20 @@ public static List<Script> preprocess(TokenStream tokenStream,
12781278 * @throws com.laytonsmith.core.exceptions.ConfigCompileGroupException A ConfigCompileGroupException is just
12791279 * a collection of single {@link ConfigCompileException}s.
12801280 */
1281- public static ParseTree compile (TokenStream stream , Environment environment ,
1281+ public static ParseTree compile (TokenStream stream , Environment env ,
12821282 Set <Class <? extends Environment .EnvironmentImpl >> envs ) throws ConfigCompileException ,
12831283 ConfigCompileGroupException {
1284- return compile (stream , environment , envs , new StaticAnalysis (true ));
1284+ return compile (stream , env , envs , new StaticAnalysis (true ));
12851285 }
12861286
12871287 /**
12881288 * Compiles the token stream into a valid ParseTree. This also includes optimization and reduction.
12891289 *
12901290 * @param stream The token stream, as generated by {@link #lex(String, Environment, File, boolean) lex}
1291- * @param environment If an environment is already set up, it can be passed in here. The code will tolerate a null
1291+ * @param env If an environment is already set up, it can be passed in here. The code will tolerate a null
12921292 * value, but if present, should be passed in. If the value is null, a standalone environment will be generated
12931293 * and used.
1294- * @param envs The environments that are going to be present at runtime. Even if the {@code environment } parameter
1294+ * @param envs The environments that are going to be present at runtime. Even if the {@code env } parameter
12951295 * is null, this still must be non-null and populated with one or more values.
12961296 * @param staticAnalysis The static analysis object, or {@code null} to not perform static analysis. This object
12971297 * is used to perform static analysis on the AST that results from parsing, before any AST optimizations.
@@ -1304,22 +1304,22 @@ public static ParseTree compile(TokenStream stream, Environment environment,
13041304 * @throws com.laytonsmith.core.exceptions.ConfigCompileGroupException A ConfigCompileGroupException is just
13051305 * a collection of single {@link ConfigCompileException}s.
13061306 */
1307- public static ParseTree compile (TokenStream stream , Environment environment ,
1307+ public static ParseTree compile (TokenStream stream , Environment env ,
13081308 Set <Class <? extends Environment .EnvironmentImpl >> envs , StaticAnalysis staticAnalysis )
13091309 throws ConfigCompileException , ConfigCompileGroupException {
13101310 Objects .requireNonNull (envs , "envs parameter must not be null" );
13111311 Objects .requireNonNull (staticAnalysis , "Static Analysis may be disabled, but cannot be null." );
13121312 try {
1313- if (environment == null ) {
1313+ if (env == null ) {
13141314 // We MUST have a CompilerEnvironment. It doesn't need to be used, but we have to create it at
13151315 // this stage.
1316- environment = Static .GenerateStandaloneEnvironment (false );
1316+ env = Static .GenerateStandaloneEnvironment (false );
13171317 }
1318- if (!environment .hasEnv (CompilerEnvironment .class )) {
1318+ if (!env .hasEnv (CompilerEnvironment .class )) {
13191319 Environment e = Static .GenerateStandaloneEnvironment (false );
1320- environment = environment .cloneAndAdd (e .getEnv (CompilerEnvironment .class ));
1320+ env = env .cloneAndAdd (e .getEnv (CompilerEnvironment .class ));
13211321 }
1322- environment .getEnv (CompilerEnvironment .class ).setStaticAnalysis (staticAnalysis );
1322+ env .getEnv (CompilerEnvironment .class ).setStaticAnalysis (staticAnalysis );
13231323 } catch (IOException | DataSourceException | URISyntaxException | Profiles .InvalidProfileException ex ) {
13241324 throw new RuntimeException (ex );
13251325 }
@@ -1328,7 +1328,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
13281328 // Return a null AST when the program is empty.
13291329 // Do run static analysis to allow for including this empty file in another file.
13301330 if (stream == null || stream .isEmpty ()) {
1331- staticAnalysis .analyze (null , environment , envs , compilerErrors );
1331+ staticAnalysis .analyze (null , env , envs , compilerErrors );
13321332 return null ;
13331333 }
13341334
@@ -1348,7 +1348,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
13481348 }
13491349 }
13501350
1351- processEarlyKeywords (stream , environment , compilerErrors );
1351+ processEarlyKeywords (stream , env , compilerErrors );
13521352 // All early keyword errors are handled, but then we halt compilation at this stage, since most
13531353 // further errors are likley meaningless.
13541354 if (!compilerErrors .isEmpty ()) {
@@ -1547,7 +1547,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
15471547 + " usage." ;
15481548 CompilerWarning warning = new CompilerWarning (msg , t .target ,
15491549 FileOptions .SuppressWarning .CodeUpgradeNotices );
1550- environment .getEnv (CompilerEnvironment .class ).addCodeUpgradeNotice (fileOptions , warning );
1550+ env .getEnv (CompilerEnvironment .class ).addCodeUpgradeNotice (fileOptions , warning );
15511551 }
15521552 } catch (ConfigCompileException ex ) {
15531553 // The function doesn't exist. It may be a compile error later (or maybe not, if it's
@@ -1576,7 +1576,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
15761576 + " this warning will go away. If it is intended, move this parenthesis up to the same"
15771577 + " line to actually execute it." , t .target ,
15781578 SuppressWarning .PossibleUnexpectedExecution );
1579- environment .getEnv (CompilerEnvironment .class ).addCompilerWarning (fileOptions , warning );
1579+ env .getEnv (CompilerEnvironment .class ).addCompilerWarning (fileOptions , warning );
15801580 f = new ParseTree (new CFunction (Compiler .__autoconcat__ .NAME , unknown ), fileOptions );
15811581 } else {
15821582 f = new ParseTree (new CFunction (Compiler .p .NAME , t .getTarget ()), fileOptions );
@@ -1922,21 +1922,21 @@ public static ParseTree compile(TokenStream stream, Environment environment,
19221922 // Process the AST.
19231923 Stack <List <Procedure >> procs = new Stack <>();
19241924 procs .add (new ArrayList <>());
1925- processKeywords (tree , environment , compilerErrors );
1926- addSelfStatements (tree , environment , envs , compilerErrors );
1927- rewriteAutoconcats (tree , environment , envs , compilerErrors , true );
1928- processLateKeywords (tree , environment , compilerErrors );
1929- checkLinearComponents (tree , environment , compilerErrors );
1930- postParseRewrite (rootNode , environment , envs , compilerErrors , true ); // Pass rootNode since this might rewrite 'tree'.
1925+ processKeywords (tree , env , compilerErrors );
1926+ addSelfStatements (tree , env , envs , compilerErrors );
1927+ rewriteAutoconcats (tree , env , envs , compilerErrors , true );
1928+ processLateKeywords (tree , env , compilerErrors );
1929+ checkLinearComponents (tree , env , compilerErrors );
1930+ postParseRewrite (rootNode , env , envs , compilerErrors , true ); // Pass rootNode since this might rewrite 'tree'.
19311931 tree = rootNode .getChildAt (0 );
19321932 moveNodeModifiersOffSyntheticNodes (tree );
1933- staticAnalysis .analyze (tree , environment , envs , compilerErrors );
1934- optimize (tree , environment , envs , procs , compilerErrors );
1933+ staticAnalysis .analyze (tree , env , envs , compilerErrors );
1934+ optimize (tree , env , envs , procs , compilerErrors );
19351935 link (tree , compilerErrors );
19361936 checkFunctionsExist (tree , compilerErrors , envs );
19371937 checkBreaks (tree , compilerErrors );
19381938 if (!staticAnalysis .isLocalEnabled ()) {
1939- checkUnhandledCompilerConstructs (tree , environment , compilerErrors );
1939+ checkUnhandledCompilerConstructs (tree , env , compilerErrors );
19401940 }
19411941 if (!compilerErrors .isEmpty ()) {
19421942 if (compilerErrors .size () == 1 ) {
@@ -1946,7 +1946,7 @@ public static ParseTree compile(TokenStream stream, Environment environment,
19461946 throw new ConfigCompileGroupException (compilerErrors );
19471947 }
19481948 }
1949- eliminateDeadCode (tree , environment , envs );
1949+ eliminateDeadCode (tree , env , envs );
19501950 return rootNode ;
19511951 }
19521952
0 commit comments