LCOV - code coverage report
Current view: top level - boolean_selector-2.1.0/lib/src - token.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 7 42.9 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
       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.
       4             : 
       5             : import 'package:source_span/source_span.dart';
       6             : 
       7             : /// A token in a boolean selector.
       8             : class Token {
       9             :   /// The type of the token.
      10             :   final TokenType type;
      11             : 
      12             :   /// The span indicating where this token came from.
      13             :   ///
      14             :   /// This is a [FileSpan] because the tokens are parsed from a single
      15             :   /// continuous string, but the string itself isn't actually a file. It might
      16             :   /// come from a statically-parsed annotation or from a parameter.
      17             :   final FileSpan span;
      18             : 
      19           5 :   Token(this.type, this.span);
      20             : }
      21             : 
      22             : /// A token representing an identifier.
      23             : class IdentifierToken implements Token {
      24             :   @override
      25             :   final type = TokenType.identifier;
      26             :   @override
      27             :   final FileSpan span;
      28             : 
      29             :   /// The name of the identifier.
      30             :   final String name;
      31             : 
      32           5 :   IdentifierToken(this.name, this.span);
      33             : 
      34           0 :   @override
      35           0 :   String toString() => 'identifier "$name"';
      36             : }
      37             : 
      38             : /// An enumeration of types of tokens.
      39             : class TokenType {
      40             :   /// A `(` character.
      41             :   static const leftParen = TokenType._('left paren');
      42             : 
      43             :   /// A `)` character.
      44             :   static const rightParen = TokenType._('right paren');
      45             : 
      46             :   /// A `||` sequence.
      47             :   static const or = TokenType._('or');
      48             : 
      49             :   /// A `&&` sequence.
      50             :   static const and = TokenType._('and');
      51             : 
      52             :   /// A `!` character.
      53             :   static const not = TokenType._('not');
      54             : 
      55             :   /// A `?` character.
      56             :   static const questionMark = TokenType._('question mark');
      57             : 
      58             :   /// A `:` character.
      59             :   static const colon = TokenType._('colon');
      60             : 
      61             :   /// A named identifier.
      62             :   static const identifier = TokenType._('identifier');
      63             : 
      64             :   /// The end of the selector.
      65             :   static const endOfFile = TokenType._('end of file');
      66             : 
      67             :   /// The name of the token type.
      68             :   final String name;
      69             : 
      70          11 :   const TokenType._(this.name);
      71             : 
      72           0 :   @override
      73           0 :   String toString() => name;
      74             : }

Generated by: LCOV version 1.14