src/main/java/com/bazaarvoice/jless/LessProcessor.java
public Result process(Result parent, InputStream input) throws IOException {
        ValueStack<Node> stack = new DefaultValueStack<Node>();

        // Make the scope of each parent result accessible for variable and mixin resolution during parsing
        ScopeNode parentScope = null;
        if (parent != null) {
            parentScope = parent.getScope();
            stack.push(parentScope);
        }

        // Parse the input
        ParseRunner<Node> parseRunner = new ReportingParseRunner<Node>(Parboiled.createParser(Parser.class, _translationEnabled).Document()).withValueStack(stack);
        ParsingResult<Node> result = parseRunner.run(IOUtils.toString(input, "UTF-8"));

        if (result.hasErrors()) {
            throw new LessTranslationException("An error occurred while parsing a LESS input file:\n" +
                    ErrorUtils.printParseErrors(result));
        }

        // Retrieve the processed result
        ScopeNode scope = (ScopeNode) stack.pop();

        // Link the new scope to the last parent for later variable resolution
        if (parentScope != null) {
            scope.setParentScope(parentScope);
        }

        return new Result(scope);
    }
public Result process(Result parent, InputStream input) throws IOException {
        ValueStack<Node> stack = new DefaultValueStack<Node>();

        // Make the scope of each parent result accessible for variable and mixin resolution during parsing
        ScopeNode parentScope = null;
        if (parent != null) {
            parentScope = parent.getScope();
            stack.push(parentScope);
        }

        // Parse the input
        ParseRunner<Node> parseRunner = new ReportingParseRunner<Node>(Parboiled.createParser(Parser.class, _translationEnabled).Document()).withValueStack(stack);
        ParsingResult<Node> result = parseRunner.run(IOUtils.toString(input, "UTF-8"));

        if (result.hasErrors()) {
            throw new LessTranslationException("An error occurred while parsing a LESS input file:\n" +
                    ErrorUtils.printParseErrors(result));
        }

        // Retrieve the processed result
        ScopeNode scope = (ScopeNode) stack.pop();

        // Link the new scope to the last parent for later variable resolution
        if (parentScope != null) {
            scope.setParentScope(parentScope);
        }

        return new Result(scope);
    }
public Result process ( Result parent , InputStream input ) throws IOException { ValueStack < Node > stack = new DefaultValueStack < Node > ( ) ; // Make the scope of each parent result accessible for variable and mixin resolution during parsing ScopeNode parentScope = null ; if ( parent != null ) { parentScope = parent . getScope ( ) ; stack . push ( parentScope ) ; } // Parse the input ParseRunner < Node > parseRunner = new ReportingParseRunner < Node > ( Parboiled . createParser ( Parser . class , _translationEnabled ) . Document ( ) ) . withValueStack ( stack ) ; ParsingResult < Node > result = parseRunner . run ( IOUtils . toString ( input , "UTF-8" ) ) ; if ( result . hasErrors ( ) ) { throw new LessTranslationException ( "An error occurred while parsing a LESS input file:\n" + ErrorUtils . printParseErrors ( result ) ) ; } // Retrieve the processed result ScopeNode scope = ( ScopeNode ) stack . pop ( ) ; // Link the new scope to the last parent for later variable resolution if ( parentScope != null ) { scope . setParentScope ( parentScope ) ; } return new Result ( scope ) ; }
The {@link ScopeNode} from a parent's result is placed on the parser's {@link ValueStack} and joined
together to allow for variable and mixin resolution across scopes.
@return A printable {@link Result} of processing the given input.
The {