Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: pkg/csslib/lib/parser.dart

Issue 50703011: fix csslib and watcher warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library csslib.parser; 5 library csslib.parser;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 8
9 import 'package:source_maps/span.dart' show SourceFile, Span, FileSpan; 9 import 'package:source_maps/span.dart' show SourceFile, Span, FileSpan;
10 10
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (_maybeEat(TokenKind.COLON)) { 563 if (_maybeEat(TokenKind.COLON)) {
564 if (_peekIdentifier()) { 564 if (_peekIdentifier()) {
565 pseudoPage = identifier(); 565 pseudoPage = identifier();
566 // TODO(terry): Normalize pseudoPage to lowercase. 566 // TODO(terry): Normalize pseudoPage to lowercase.
567 if (isChecked && 567 if (isChecked &&
568 !(pseudoPage.name == 'left' || 568 !(pseudoPage.name == 'left' ||
569 pseudoPage.name == 'right' || 569 pseudoPage.name == 'right' ||
570 pseudoPage.name == 'first')) { 570 pseudoPage.name == 'first')) {
571 _warning("Pseudo page must be left, top or first", 571 _warning("Pseudo page must be left, top or first",
572 pseudoPage.span); 572 pseudoPage.span);
573 return; 573 return null;
574 } 574 }
575 } 575 }
576 } 576 }
577 577
578 String pseudoName = pseudoPage is Identifier ? pseudoPage.name : ''; 578 String pseudoName = pseudoPage is Identifier ? pseudoPage.name : '';
579 String ident = name is Identifier ? name.name : ''; 579 String ident = name is Identifier ? name.name : '';
580 return new PageDirective(ident, pseudoName, 580 return new PageDirective(ident, pseudoName,
581 processMarginsDeclarations(), _makeSpan(start)); 581 processMarginsDeclarations(), _makeSpan(start));
582 582
583 case TokenKind.DIRECTIVE_CHARSET: 583 case TokenKind.DIRECTIVE_CHARSET:
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 case TokenKind.DIRECTIVE_MIXIN: 736 case TokenKind.DIRECTIVE_MIXIN:
737 return processMixin(start); 737 return processMixin(start);
738 738
739 case TokenKind.DIRECTIVE_INCLUDE: 739 case TokenKind.DIRECTIVE_INCLUDE:
740 return processInclude( _makeSpan(start)); 740 return processInclude( _makeSpan(start));
741 741
742 case TokenKind.DIRECTIVE_CONTENT: 742 case TokenKind.DIRECTIVE_CONTENT:
743 // TODO(terry): TBD 743 // TODO(terry): TBD
744 _warning("@content not implemented.", _makeSpan(start)); 744 _warning("@content not implemented.", _makeSpan(start));
745 return; 745 return null;
746 } 746 }
747 return null;
747 } 748 }
748 749
749 /** 750 /**
750 * Parse the mixin beginning token offset [start]. Returns a [MixinDefinition] 751 * Parse the mixin beginning token offset [start]. Returns a [MixinDefinition]
751 * node. 752 * node.
752 * 753 *
753 * Mixin grammar: 754 * Mixin grammar:
754 * 755 *
755 * @mixin IDENT [(args,...)] '{' 756 * @mixin IDENT [(args,...)] '{'
756 * [ruleset | property | directive]* 757 * [ruleset | property | directive]*
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 case _paddingPartLeft: 1884 case _paddingPartLeft:
1884 case _paddingPartTop: 1885 case _paddingPartTop:
1885 case _paddingPartRight: 1886 case _paddingPartRight:
1886 case _paddingPartBottom: 1887 case _paddingPartBottom:
1887 if (exprs.expressions.length > 0) { 1888 if (exprs.expressions.length > 0) {
1888 return processOneNumber(exprs, styleType); 1889 return processOneNumber(exprs, styleType);
1889 } 1890 }
1890 break; 1891 break;
1891 default: 1892 default:
1892 // Don't handle it. 1893 // Don't handle it.
1893 return; 1894 return null;
1894 } 1895 }
1895 } 1896 }
1896 1897
1897 // TODO(terry): Look at handling width of thin, thick, etc. any none numbers 1898 // TODO(terry): Look at handling width of thin, thick, etc. any none numbers
1898 // to convert to a number. 1899 // to convert to a number.
1899 processOneNumber(Expressions exprs, int part) { 1900 processOneNumber(Expressions exprs, int part) {
1900 var value = marginValue(exprs.expressions[0]); 1901 var value = marginValue(exprs.expressions[0]);
1901 if (value != null) { 1902 if (value != null) {
1902 switch (part) { 1903 switch (part) {
1903 case _marginPartLeft: 1904 case _marginPartLeft:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 left = right; 1973 left = right;
1973 bottom = marginValue(exprs.expressions[2]); 1974 bottom = marginValue(exprs.expressions[2]);
1974 break; 1975 break;
1975 case 4: 1976 case 4:
1976 top = marginValue(exprs.expressions[0]); 1977 top = marginValue(exprs.expressions[0]);
1977 right = marginValue(exprs.expressions[1]); 1978 right = marginValue(exprs.expressions[1]);
1978 bottom = marginValue(exprs.expressions[2]); 1979 bottom = marginValue(exprs.expressions[2]);
1979 left = marginValue(exprs.expressions[3]); 1980 left = marginValue(exprs.expressions[3]);
1980 break; 1981 break;
1981 default: 1982 default:
1982 return; 1983 return null;
1983 } 1984 }
1984 1985
1985 return new BoxEdge.clockwiseFromTop(top, right, bottom, left); 1986 return new BoxEdge.clockwiseFromTop(top, right, bottom, left);
1986 } 1987 }
1987 1988
1988 // TODO(terry): Need to handle auto. 1989 // TODO(terry): Need to handle auto.
1989 marginValue(var exprTerm) { 1990 marginValue(var exprTerm) {
1990 if (exprTerm is UnitTerm || exprTerm is NumberTerm) { 1991 if (exprTerm is UnitTerm || exprTerm is NumberTerm) {
1991 return exprTerm.value; 1992 return exprTerm.value;
1992 } 1993 }
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 2654
2654 if (replace != null && result == null) { 2655 if (replace != null && result == null) {
2655 result = new StringBuffer(text.substring(0, i)); 2656 result = new StringBuffer(text.substring(0, i));
2656 } 2657 }
2657 2658
2658 if (result != null) result.write(replace != null ? replace : text[i]); 2659 if (result != null) result.write(replace != null ? replace : text[i]);
2659 } 2660 }
2660 2661
2661 return result == null ? text : result.toString(); 2662 return result == null ? text : result.toString();
2662 } 2663 }
OLDNEW
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698