bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
function(checkStart, readMargins){
                /*
                 * Reads the pattern
                 * S* '{' S* declaration [ ';' S* declaration ]* '}' S*
                 * or
                 * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
                 * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
                 * A semicolon is only necessary following a declaration if there's another declaration
                 * or margin afterwards.
                 */
                var tokenStream = this._tokenStream,
                    tt;


                this._readWhitespace();
				var node = this.startNode('DeclarationBody', this._tokenStream.curr().range[0], 'declarationBody'); // ORION AST Generation
				node.declarations = []; // ORION AST Generation
                if (checkStart){
                    tokenStream.mustMatch(Tokens.LBRACE);
                }

                this._readWhitespace();

                try {

                    while(true){

                        if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
                            //noop
                        } else if (this._declaration()){
                            if (!tokenStream.match(Tokens.SEMICOLON)){
                                break;
                            }
                        } else {
                            break;
                        }

                        //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){
                        //    break;
                        //}
                        this._readWhitespace();
                    }

                    tokenStream.mustMatch(Tokens.RBRACE);
                    this._readWhitespace();

                } catch (ex) {
                    if (ex instanceof SyntaxError && !this.options.strict){

                        //fire error event
                        this.fire({
                            type:       "error",
                            error:      ex,
                            message:    ex.message,
                            line:       ex.line,
                            col:        ex.col
                        });

                        //see if there's another declaration
                        tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
                        if (tt === Tokens.SEMICOLON){
                            //if there's a semicolon, then there might be another declaration
                            this._readDeclarations(false, readMargins);
                        } else if (tt !== Tokens.RBRACE){
                            //if there's a right brace, the rule is finished so don't do anything
                            //otherwise, rethrow the error because it wasn't handled properly
                            throw ex;
                        }

                    } else {
                        //not a syntax error, rethrow it
                        throw ex;
                    }
                }

                var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
            	this.endNode(node, rbraceRange[1]); //ORION AST Generation
            }
function(checkStart, readMargins){
                /*
                 * Reads the pattern
                 * S* '{' S* declaration [ ';' S* declaration ]* '}' S*
                 * or
                 * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
                 * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
                 * A semicolon is only necessary following a declaration if there's another declaration
                 * or margin afterwards.
                 */
                var tokenStream = this._tokenStream,
                    tt;


                this._readWhitespace();
				var node = this.startNode('DeclarationBody', this._tokenStream.curr().range[0], 'declarationBody'); // ORION AST Generation
				node.declarations = []; // ORION AST Generation
                if (checkStart){
                    tokenStream.mustMatch(Tokens.LBRACE);
                }

                this._readWhitespace();

                try {

                    while(true){

                        if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
                            //noop
                        } else if (this._declaration()){
                            if (!tokenStream.match(Tokens.SEMICOLON)){
                                break;
                            }
                        } else {
                            break;
                        }

                        //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){
                        //    break;
                        //}
                        this._readWhitespace();
                    }

                    tokenStream.mustMatch(Tokens.RBRACE);
                    this._readWhitespace();

                } catch (ex) {
                    if (ex instanceof SyntaxError && !this.options.strict){

                        //fire error event
                        this.fire({
                            type:       "error",
                            error:      ex,
                            message:    ex.message,
                            line:       ex.line,
                            col:        ex.col
                        });

                        //see if there's another declaration
                        tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
                        if (tt === Tokens.SEMICOLON){
                            //if there's a semicolon, then there might be another declaration
                            this._readDeclarations(false, readMargins);
                        } else if (tt !== Tokens.RBRACE){
                            //if there's a right brace, the rule is finished so don't do anything
                            //otherwise, rethrow the error because it wasn't handled properly
                            throw ex;
                        }

                    } else {
                        //not a syntax error, rethrow it
                        throw ex;
                    }
                }

                var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
            	this.endNode(node, rbraceRange[1]); //ORION AST Generation
            }
function ( checkStart , readMargins ) { /*
                 * Reads the pattern
                 * S* '{' S* declaration [ ';' S* declaration ]* '}' S*
                 * or
                 * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
                 * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
                 * A semicolon is only necessary following a declaration if there's another declaration
                 * or margin afterwards.
                 */ var tokenStream = this . _tokenStream , tt ; this . _readWhitespace ( ) ; var node = this . startNode ( 'DeclarationBody' , this . _tokenStream . curr ( ) . range [ 0 ] , 'declarationBody' ) ; // ORION AST Generation node . declarations = [ ] ; // ORION AST Generation if ( checkStart ) { tokenStream . mustMatch ( Tokens . LBRACE ) ; } this . _readWhitespace ( ) ; try { while ( true ) { if ( tokenStream . match ( Tokens . SEMICOLON ) || ( readMargins && this . _margin ( ) ) ) { //noop } else if ( this . _declaration ( ) ) { if ( ! tokenStream . match ( Tokens . SEMICOLON ) ) { break ; } } else { break ; } //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ //    break; //} this . _readWhitespace ( ) ; } tokenStream . mustMatch ( Tokens . RBRACE ) ; this . _readWhitespace ( ) ; } catch ( ex ) { if ( ex instanceof SyntaxError && ! this . options . strict ) { //fire error event this . fire ( { type : "error" , error : ex , message : ex . message , line : ex . line , col : ex . col } ) ; //see if there's another declaration tt = tokenStream . advance ( [ Tokens . SEMICOLON , Tokens . RBRACE ] ) ; if ( tt === Tokens . SEMICOLON ) { //if there's a semicolon, then there might be another declaration this . _readDeclarations ( false , readMargins ) ; } else if ( tt !== Tokens . RBRACE ) { //if there's a right brace, the rule is finished so don't do anything //otherwise, rethrow the error because it wasn't handled properly throw ex ; } } else { //not a syntax error, rethrow it throw ex ; } } var rbraceRange = this . findLastTokenRange ( 'RBRACE' , node . range [ 0 ] ) ; // ORION AST Generation select the RBRACE token this . endNode ( node , rbraceRange [ 1 ] ) ; //ORION AST Generation }
Not part of CSS grammar, but this pattern occurs frequently
in the official CSS grammar. Split out here to eliminate
duplicate code.
@param {Boolean} checkStart Indicates if the rule should check
for the left brace at the beginning.
@param {Boolean} readMargins Indicates if the rule should check
for margin patterns.
@return {void}
@method _readDeclarations
@private
Not part of CSS grammar but this pattern occurs frequently in the official CSS grammar . Split out here to eliminate duplicate code .