...

Text file src/github.com/alecthomas/chroma/lexers/testdata/dart.expected

Documentation: github.com/alecthomas/chroma/lexers/testdata

     1[
     2  {"type":"Keyword","value":"import"},
     3  {"type":"Text","value":" "},
     4  {"type":"LiteralStringSingle","value":"'dart:async'"},
     5  {"type":"Punctuation","value":";"},
     6  {"type":"Text","value":"\n"},
     7  {"type":"Keyword","value":"import"},
     8  {"type":"Text","value":" "},
     9  {"type":"LiteralStringSingle","value":"'dart:html'"},
    10  {"type":"Punctuation","value":";"},
    11  {"type":"Text","value":"\n"},
    12  {"type":"Keyword","value":"import"},
    13  {"type":"Text","value":" "},
    14  {"type":"LiteralStringSingle","value":"'dart:math'"},
    15  {"type":"Text","value":" "},
    16  {"type":"Keyword","value":"show"},
    17  {"type":"Text","value":" "},
    18  {"type":"Name","value":"Random"},
    19  {"type":"Punctuation","value":";"},
    20  {"type":"Text","value":"\n\n"},
    21  {"type":"CommentSingle","value":"// We changed 5 lines of code to make this sample nicer on\n// the web (so that the execution waits for animation frame, \n// the number gets updated in the DOM, and the program ends \n// after 500 iterations).\n"},
    22  {"type":"Text","value":"\n"},
    23  {"type":"Name","value":"main"},
    24  {"type":"Punctuation","value":"()"},
    25  {"type":"Text","value":" "},
    26  {"type":"KeywordDeclaration","value":"async"},
    27  {"type":"Text","value":" "},
    28  {"type":"Punctuation","value":"{"},
    29  {"type":"Text","value":"\n  "},
    30  {"type":"Name","value":"print"},
    31  {"type":"Punctuation","value":"("},
    32  {"type":"LiteralStringSingle","value":"'Compute π using the Monte Carlo method.'"},
    33  {"type":"Punctuation","value":");"},
    34  {"type":"Text","value":"\n  "},
    35  {"type":"KeywordDeclaration","value":"var"},
    36  {"type":"Text","value":" "},
    37  {"type":"Name","value":"output"},
    38  {"type":"Text","value":" "},
    39  {"type":"Operator","value":"="},
    40  {"type":"Text","value":" "},
    41  {"type":"Name","value":"querySelector"},
    42  {"type":"Punctuation","value":"("},
    43  {"type":"LiteralStringDouble","value":"\"#output\""},
    44  {"type":"Punctuation","value":");"},
    45  {"type":"Text","value":"\n  "},
    46  {"type":"KeywordDeclaration","value":"await"},
    47  {"type":"Text","value":" "},
    48  {"type":"Keyword","value":"for"},
    49  {"type":"Text","value":" "},
    50  {"type":"Punctuation","value":"("},
    51  {"type":"KeywordDeclaration","value":"var"},
    52  {"type":"Text","value":" "},
    53  {"type":"Name","value":"estimate"},
    54  {"type":"Text","value":" "},
    55  {"type":"Keyword","value":"in"},
    56  {"type":"Text","value":" "},
    57  {"type":"Name","value":"computePi"},
    58  {"type":"Punctuation","value":"()."},
    59  {"type":"Name","value":"take"},
    60  {"type":"Punctuation","value":"("},
    61  {"type":"LiteralNumber","value":"500"},
    62  {"type":"Punctuation","value":"))"},
    63  {"type":"Text","value":" "},
    64  {"type":"Punctuation","value":"{"},
    65  {"type":"Text","value":"\n    "},
    66  {"type":"Name","value":"print"},
    67  {"type":"Punctuation","value":"("},
    68  {"type":"LiteralStringSingle","value":"'π ≅ "},
    69  {"type":"LiteralStringInterpol","value":"$"},
    70  {"type":"Name","value":"estimate"},
    71  {"type":"LiteralStringSingle","value":"'"},
    72  {"type":"Punctuation","value":");"},
    73  {"type":"Text","value":"\n    "},
    74  {"type":"Name","value":"output"},
    75  {"type":"Punctuation","value":"."},
    76  {"type":"Name","value":"text"},
    77  {"type":"Text","value":" "},
    78  {"type":"Operator","value":"="},
    79  {"type":"Text","value":" "},
    80  {"type":"Name","value":"estimate"},
    81  {"type":"Punctuation","value":"."},
    82  {"type":"Name","value":"toStringAsFixed"},
    83  {"type":"Punctuation","value":"("},
    84  {"type":"LiteralNumber","value":"5"},
    85  {"type":"Punctuation","value":");"},
    86  {"type":"Text","value":"\n    "},
    87  {"type":"KeywordDeclaration","value":"await"},
    88  {"type":"Text","value":" "},
    89  {"type":"Name","value":"window"},
    90  {"type":"Punctuation","value":"."},
    91  {"type":"Name","value":"animationFrame"},
    92  {"type":"Punctuation","value":";"},
    93  {"type":"Text","value":"\n  "},
    94  {"type":"Punctuation","value":"}"},
    95  {"type":"Text","value":"\n"},
    96  {"type":"Punctuation","value":"}"},
    97  {"type":"Text","value":"\n\n"},
    98  {"type":"CommentSingle","value":"/// Generates a stream of increasingly accurate estimates of π.\n"},
    99  {"type":"Name","value":"Stream"},
   100  {"type":"Operator","value":"\u003c"},
   101  {"type":"KeywordType","value":"double"},
   102  {"type":"Operator","value":"\u003e"},
   103  {"type":"Text","value":" "},
   104  {"type":"Name","value":"computePi"},
   105  {"type":"Punctuation","value":"({"},
   106  {"type":"KeywordType","value":"int"},
   107  {"type":"Text","value":" "},
   108  {"type":"NameLabel","value":"batch:"},
   109  {"type":"Text","value":" "},
   110  {"type":"LiteralNumber","value":"100000"},
   111  {"type":"Punctuation","value":"})"},
   112  {"type":"Text","value":" "},
   113  {"type":"KeywordDeclaration","value":"async"},
   114  {"type":"Operator","value":"*"},
   115  {"type":"Text","value":" "},
   116  {"type":"Punctuation","value":"{"},
   117  {"type":"Text","value":"\n  "},
   118  {"type":"KeywordDeclaration","value":"var"},
   119  {"type":"Text","value":" "},
   120  {"type":"Name","value":"total"},
   121  {"type":"Text","value":" "},
   122  {"type":"Operator","value":"="},
   123  {"type":"Text","value":" "},
   124  {"type":"LiteralNumber","value":"0"},
   125  {"type":"Punctuation","value":";"},
   126  {"type":"Text","value":"\n  "},
   127  {"type":"KeywordDeclaration","value":"var"},
   128  {"type":"Text","value":" "},
   129  {"type":"Name","value":"count"},
   130  {"type":"Text","value":" "},
   131  {"type":"Operator","value":"="},
   132  {"type":"Text","value":" "},
   133  {"type":"LiteralNumber","value":"0"},
   134  {"type":"Punctuation","value":";"},
   135  {"type":"Text","value":"\n  "},
   136  {"type":"Keyword","value":"while"},
   137  {"type":"Text","value":" "},
   138  {"type":"Punctuation","value":"("},
   139  {"type":"KeywordConstant","value":"true"},
   140  {"type":"Punctuation","value":")"},
   141  {"type":"Text","value":" "},
   142  {"type":"Punctuation","value":"{"},
   143  {"type":"Text","value":"\n    "},
   144  {"type":"KeywordDeclaration","value":"var"},
   145  {"type":"Text","value":" "},
   146  {"type":"Name","value":"points"},
   147  {"type":"Text","value":" "},
   148  {"type":"Operator","value":"="},
   149  {"type":"Text","value":" "},
   150  {"type":"Name","value":"generateRandom"},
   151  {"type":"Punctuation","value":"()."},
   152  {"type":"Name","value":"take"},
   153  {"type":"Punctuation","value":"("},
   154  {"type":"Name","value":"batch"},
   155  {"type":"Punctuation","value":");"},
   156  {"type":"Text","value":"\n    "},
   157  {"type":"KeywordDeclaration","value":"var"},
   158  {"type":"Text","value":" "},
   159  {"type":"Name","value":"inside"},
   160  {"type":"Text","value":" "},
   161  {"type":"Operator","value":"="},
   162  {"type":"Text","value":" "},
   163  {"type":"Name","value":"points"},
   164  {"type":"Punctuation","value":"."},
   165  {"type":"Name","value":"where"},
   166  {"type":"Punctuation","value":"(("},
   167  {"type":"Name","value":"p"},
   168  {"type":"Punctuation","value":")"},
   169  {"type":"Text","value":" "},
   170  {"type":"Operator","value":"=\u003e"},
   171  {"type":"Text","value":" "},
   172  {"type":"Name","value":"p"},
   173  {"type":"Punctuation","value":"."},
   174  {"type":"Name","value":"isInsideUnitCircle"},
   175  {"type":"Punctuation","value":");"},
   176  {"type":"Text","value":"\n    "},
   177  {"type":"Name","value":"total"},
   178  {"type":"Text","value":" "},
   179  {"type":"Operator","value":"+="},
   180  {"type":"Text","value":" "},
   181  {"type":"Name","value":"batch"},
   182  {"type":"Punctuation","value":";"},
   183  {"type":"Text","value":"\n    "},
   184  {"type":"Name","value":"count"},
   185  {"type":"Text","value":" "},
   186  {"type":"Operator","value":"+="},
   187  {"type":"Text","value":" "},
   188  {"type":"Name","value":"inside"},
   189  {"type":"Punctuation","value":"."},
   190  {"type":"Name","value":"length"},
   191  {"type":"Punctuation","value":";"},
   192  {"type":"Text","value":"\n    "},
   193  {"type":"KeywordDeclaration","value":"var"},
   194  {"type":"Text","value":" "},
   195  {"type":"Name","value":"ratio"},
   196  {"type":"Text","value":" "},
   197  {"type":"Operator","value":"="},
   198  {"type":"Text","value":" "},
   199  {"type":"Name","value":"count"},
   200  {"type":"Text","value":" "},
   201  {"type":"Operator","value":"/"},
   202  {"type":"Text","value":" "},
   203  {"type":"Name","value":"total"},
   204  {"type":"Punctuation","value":";"},
   205  {"type":"Text","value":"\n    "},
   206  {"type":"CommentSingle","value":"// Area of a circle is A = π⋅r², therefore π = A/r².\n"},
   207  {"type":"Text","value":"    "},
   208  {"type":"CommentSingle","value":"// So, when given random points with x ∈ \u003c0,1\u003e,\n"},
   209  {"type":"Text","value":"    "},
   210  {"type":"CommentSingle","value":"// y ∈ \u003c0,1\u003e, the ratio of those inside a unit circle\n"},
   211  {"type":"Text","value":"    "},
   212  {"type":"CommentSingle","value":"// should approach π / 4. Therefore, the value of π\n"},
   213  {"type":"Text","value":"    "},
   214  {"type":"CommentSingle","value":"// should be:\n"},
   215  {"type":"Text","value":"    "},
   216  {"type":"KeywordDeclaration","value":"yield"},
   217  {"type":"Text","value":" "},
   218  {"type":"Name","value":"ratio"},
   219  {"type":"Text","value":" "},
   220  {"type":"Operator","value":"*"},
   221  {"type":"Text","value":" "},
   222  {"type":"LiteralNumber","value":"4"},
   223  {"type":"Punctuation","value":";"},
   224  {"type":"Text","value":"\n  "},
   225  {"type":"Punctuation","value":"}"},
   226  {"type":"Text","value":"\n"},
   227  {"type":"Punctuation","value":"}"},
   228  {"type":"Text","value":"\n\n"},
   229  {"type":"Name","value":"Iterable"},
   230  {"type":"Operator","value":"\u003c"},
   231  {"type":"Name","value":"Point"},
   232  {"type":"Operator","value":"\u003e"},
   233  {"type":"Text","value":" "},
   234  {"type":"Name","value":"generateRandom"},
   235  {"type":"Punctuation","value":"(["},
   236  {"type":"KeywordType","value":"int"},
   237  {"type":"Text","value":" "},
   238  {"type":"Name","value":"seed"},
   239  {"type":"Punctuation","value":"])"},
   240  {"type":"Text","value":" "},
   241  {"type":"KeywordDeclaration","value":"sync"},
   242  {"type":"Operator","value":"*"},
   243  {"type":"Text","value":" "},
   244  {"type":"Punctuation","value":"{"},
   245  {"type":"Text","value":"\n  "},
   246  {"type":"KeywordDeclaration","value":"final"},
   247  {"type":"Text","value":" "},
   248  {"type":"Name","value":"random"},
   249  {"type":"Text","value":" "},
   250  {"type":"Operator","value":"="},
   251  {"type":"Text","value":" "},
   252  {"type":"Keyword","value":"new"},
   253  {"type":"Text","value":" "},
   254  {"type":"Name","value":"Random"},
   255  {"type":"Punctuation","value":"("},
   256  {"type":"Name","value":"seed"},
   257  {"type":"Punctuation","value":");"},
   258  {"type":"Text","value":"\n  "},
   259  {"type":"Keyword","value":"while"},
   260  {"type":"Text","value":" "},
   261  {"type":"Punctuation","value":"("},
   262  {"type":"KeywordConstant","value":"true"},
   263  {"type":"Punctuation","value":")"},
   264  {"type":"Text","value":" "},
   265  {"type":"Punctuation","value":"{"},
   266  {"type":"Text","value":"\n    "},
   267  {"type":"KeywordDeclaration","value":"yield"},
   268  {"type":"Text","value":" "},
   269  {"type":"Keyword","value":"new"},
   270  {"type":"Text","value":" "},
   271  {"type":"Name","value":"Point"},
   272  {"type":"Punctuation","value":"("},
   273  {"type":"Name","value":"random"},
   274  {"type":"Punctuation","value":"."},
   275  {"type":"Name","value":"nextDouble"},
   276  {"type":"Punctuation","value":"(),"},
   277  {"type":"Text","value":" "},
   278  {"type":"Name","value":"random"},
   279  {"type":"Punctuation","value":"."},
   280  {"type":"Name","value":"nextDouble"},
   281  {"type":"Punctuation","value":"());"},
   282  {"type":"Text","value":"\n  "},
   283  {"type":"Punctuation","value":"}"},
   284  {"type":"Text","value":"\n"},
   285  {"type":"Punctuation","value":"}"},
   286  {"type":"Text","value":"\n\n"},
   287  {"type":"KeywordDeclaration","value":"class"},
   288  {"type":"Text","value":" "},
   289  {"type":"NameClass","value":"Point"},
   290  {"type":"Text","value":" "},
   291  {"type":"Punctuation","value":"{"},
   292  {"type":"Text","value":"\n  "},
   293  {"type":"KeywordDeclaration","value":"final"},
   294  {"type":"Text","value":" "},
   295  {"type":"KeywordType","value":"double"},
   296  {"type":"Text","value":" "},
   297  {"type":"Name","value":"x"},
   298  {"type":"Punctuation","value":","},
   299  {"type":"Text","value":" "},
   300  {"type":"Name","value":"y"},
   301  {"type":"Punctuation","value":";"},
   302  {"type":"Text","value":"\n  "},
   303  {"type":"KeywordDeclaration","value":"const"},
   304  {"type":"Text","value":" "},
   305  {"type":"Name","value":"Point"},
   306  {"type":"Punctuation","value":"("},
   307  {"type":"Keyword","value":"this"},
   308  {"type":"Punctuation","value":"."},
   309  {"type":"Name","value":"x"},
   310  {"type":"Punctuation","value":","},
   311  {"type":"Text","value":" "},
   312  {"type":"Keyword","value":"this"},
   313  {"type":"Punctuation","value":"."},
   314  {"type":"Name","value":"y"},
   315  {"type":"Punctuation","value":");"},
   316  {"type":"Text","value":"\n  "},
   317  {"type":"KeywordType","value":"bool"},
   318  {"type":"Text","value":" "},
   319  {"type":"KeywordDeclaration","value":"get"},
   320  {"type":"Text","value":" "},
   321  {"type":"Name","value":"isInsideUnitCircle"},
   322  {"type":"Text","value":" "},
   323  {"type":"Operator","value":"=\u003e"},
   324  {"type":"Text","value":" "},
   325  {"type":"Name","value":"x"},
   326  {"type":"Text","value":" "},
   327  {"type":"Operator","value":"*"},
   328  {"type":"Text","value":" "},
   329  {"type":"Name","value":"x"},
   330  {"type":"Text","value":" "},
   331  {"type":"Operator","value":"+"},
   332  {"type":"Text","value":" "},
   333  {"type":"Name","value":"y"},
   334  {"type":"Text","value":" "},
   335  {"type":"Operator","value":"*"},
   336  {"type":"Text","value":" "},
   337  {"type":"Name","value":"y"},
   338  {"type":"Text","value":" "},
   339  {"type":"Operator","value":"\u003c="},
   340  {"type":"Text","value":" "},
   341  {"type":"LiteralNumber","value":"1"},
   342  {"type":"Punctuation","value":";"},
   343  {"type":"Text","value":"\n"},
   344  {"type":"Punctuation","value":"}"}
   345]

View as plain text