Package gherkin.lexer

Source Code of gherkin.lexer.Gl

// line 1 "ragel/i18n/gl.java.rl"
package gherkin.lexer;

import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.ArrayList;
import java.util.regex.Pattern;
import gherkin.lexer.Lexer;
import gherkin.lexer.Listener;
import gherkin.lexer.LexingError;

public class Gl implements Lexer {
 
// line 150 "ragel/i18n/gl.java.rl"


  private final Listener listener;

  public Gl(Listener listener) {
    this.listener = listener;
  }

 
// line 26 "java/src/main/java/gherkin/lexer/Gl.java"
private static byte[] init__lexer_actions_0()
{
  return new byte [] {
      0,    1,    0,    1,    1,    1,    2,    1,    3,    1,    4,    1,
      5,    1,    6,    1,    7,    1,    8,    1,    9,    1,   10,    1,
     11,    1,   12,    1,   13,    1,   16,    1,   17,    1,   18,    1,
     19,    1,   20,    1,   21,    1,   22,    1,   23,    2,    2,   18,
      2,    3,    4,    2,   13,    0,    2,   14,   15,    2,   17,    0,
      2,   17,    1,    2,   17,   16,    2,   17,   19,    2,   18,    6,
      2,   18,    7,    2,   18,    8,    2,   18,    9,    2,   18,   10,
      2,   18,   16,    2,   20,   21,    2,   22,    0,    2,   22,    1,
      2,   22,   16,    2,   22,   19,    3,    4,   14,   15,    3,    5,
     14,   15,    3,   11,   14,   15,    3,   12,   14,   15,    3,   13,
     14,   15,    3,   14,   15,   18,    3,   17,    0,   11,    3,   17,
     14,   15,    4,    2,   14,   15,   18,    4,    3,    4,   14,   15,
      4,   17,    0,   14,   15,    5,   17,    0,   11,   14,   15
  };
}

private static final byte _lexer_actions[] = init__lexer_actions_0();


private static short[] init__lexer_key_offsets_0()
{
  return new short [] {
      0,    0,   17,   18,   19,   35,   36,   37,   39,   41,   46,   51,
     56,   61,   65,   69,   71,   72,   73,   74,   75,   76,   77,   78,
     79,   80,   81,   82,   83,   84,   85,   86,   87,   89,   91,   96,
    103108110112113114115116117118119120,
    121122123124125126127128129138140142,
    144146148150152154156158160162164166,
    169171173175177179181183185187189191,
    193195197213214215217219223224225226,
    227229230231232233234235236237238239,
    240241242243244245246247248262264266,
    268270272274276278280282284286288290,
    292294297299301303305307309311313315,
    317319321323325327329331334337341343,
    345347349351353355357359361363365367,
    369371373375377378379380381382383384,
    385386400402404406408410412414416418,
    420422424426428430433436438440442444,
    446448450452454456458460462464466468,
    470472474476478480482485488492494496,
    498500503505507509511513515517519521,
    523525527529531533535537539541543545,
    547548549550551552553554555556563565,
    567569571573575577579581583585587589,
    591593594595596597598599600604610613,
    615621637639641643645647649652655657,
    659661663665667669671673675677679681,
    683685687689691693695697698699700701,
    702703704705706720722724726728730732,
    734736738740742744746748750752755757,
    759761763765767769771773775777779781,
    783785787789792795799801803805807810,
    812814816818820822824826828830832834,
    836838840842844846848850852854856
  };
}

private static final short _lexer_key_offsets[] = init__lexer_key_offsets_0();


private static byte[] init__lexer_trans_keys_0()
{
  return new byte [] {
    -17,   10,   32,   34,   35,   37,   42,   64,   67,   68,   69,   76,
     77,   80124,    9,   13,  -69,  -65,   10,   32,   34,   35,   37,
     42,   64,   67,   68,   69,   76,   77,   80124,    9,   13,   34,
     34,   10,   13,   10,   13,   10,   32,   34,    9,   13,   10,   32,
     34,    9,   13,   10,   32,   34,    9,   13,   10,   32,   34,    9,
     13,   10,   32,    9,   13,   10,   32,    9,   13,   10,   13,   10,
     95,   70,   69,   65,   84,   85,   82,   69,   95,   69,   78,   68,
     95,   37,   32,   10,   13,   10,   13,   13,   32,   64,    9,   10,
      9,   10,   13,   32,   64,   11,   12,   10,   32,   64,    9,   13,
     97111110114100111,   97,   99116101114,  -61,
    -83115116105,   99,   97,   58,   10,   10,   10,   32,   35,
     37,   64,   67,   69,    9,   13,   10,   95,   10,   70,   10,   69,
     10,   65,   10,   84,   10,   85,   10,   82,   10,   69,   10,   95,
     10,   69,   10,   78,   10,   68,   10,   95,   10,   37,   10,   97,
    111,   10114,   10,   97,   10,   99,   10116,   10101,   10,
    114,  -61,   10,  -83,   10,   10115,   10116,   10105,   10,
     99,   10,   97,   10,   58,   10,   32,   34,   35,   37,   42,   64,
     67,   68,   69,   76,   77,   80124,    9,   13,   97100,   97,
    111,   32115,   32110115120116,  -61,  -77110,   98,
     99111122111,   32100111,   32101115,   99101,
    110,   97114105111,   58,   10,   10,   10,   32,   35,   37,
     42,   64,   67,   68,   69,   76,   77,   80,    9,   13,   10,   95,
     10,   70,   10,   69,   10,   65,   10,   84,   10,   85,   10,   82,
     10,   69,   10,   95,   10,   69,   10,   78,   10,   68,   10,   95,
     10,   37,   10,   32,   10,   97,   10110114,   10100,   10,
    111,   10,   97,   10,   99,   10116,   10101,   10114,  -61,
     10,  -83,   10,   10115,   10116,   10105,   10,   99,   10,
     97,   10,   58,   10,   97,   10100,   10,   97111,   10,   32,
    115,   10,   32110115,   10116,  -61,   10,  -77,   10,   10,
    110,   10,   99,   10101,   10110,   10,   97,   10114,   10,
    105,   10111,   10111,   10103,   10,   97,   10105,   10,
    115,   10101,   10114101110,   97114105111,   58,
     10,   10,   10,   32,   35,   37,   42,   64,   67,   68,   69,   76,
     77,   80,    9,   13,   10,   95,   10,   70,   10,   69,   10,   65,
     10,   84,   10,   85,   10,   82,   10,   69,   10,   95,   10,   69,
     10,   78,   10,   68,   10,   95,   10,   37,   10,   32,   10,   97,
    111,   10110114,   10100,   10111,   10,   97,   10,   99,
     10116,   10101,   10114,  -61,   10,  -83,   10,   10115,
     10116,   10105,   10,   99,   10,   97,   10,   58,   10110,
     10116,   10101,   10120,   10116,   10111,   10,   97,
     10100,   10,   97111,   10,   32115,   10,   32110115,
     10116,  -61,   10,  -77,   10,   10110,   10,   98,   99,   10,
    111,   10122,   10111,   10,   32,   10100,   10111,   10,
     32,   10101,   10115,   10,   99,   10101,   10110,   10,
     97,   10114,   10105,   10111,   10103,   10,   97,   10,
    105,   10115,   10101,   10114101109112108111,
    115,   58,   10,   10,   10,   32,   35,   67124,    9,   13,   10,
     97,   10114,   10,   97,   10,   99,   10116,   10101,   10,
    114,  -61,   10,  -83,   10,   10115,   10116,   10105,   10,
     99,   10,   97,   10,   58111103,   97105115101114,
     32124,    9,   13,   10,   32,   92124,    9,   13,   10,   92,
    124,   10,   92,   10,   32,   92124,    9,   13,   10,   32,   34,
     35,   37,   42,   64,   67,   68,   69,   76,   77,   80124,    9,
     13,   10110,   10116,   10101,   10120,   10116,   10,
    111,   10115120,   10,   98,   99,   10111,   10122,   10,
    111,   10,   32,   10100,   10111,   10,   32,   10101,   10,
    115,   10,   99,   10101,   10110,   10,   97,   10114,   10,
    105,   10101,   10109,   10112,   10108,   10111,   10,
    115110116101120116111,   58,   10,   10,   10,   32,
     35,   37,   42,   64,   67,   68,   69,   76,   77,   80,    9,   13,
     10,   95,   10,   70,   10,   69,   10,   65,   10,   84,   10,   85,
     10,   82,   10,   69,   10,   95,   10,   69,   10,   78,   10,   68,
     10,   95,   10,   37,   10,   32,   10,   97,   10110114,   10,
    100,   10111,   10,   97,   10,   99,   10116,   10101,   10,
    114,  -61,   10,  -83,   10,   10115,   10116,   10105,   10,
     99,   10,   97,   10,   58,   10,   97,   10100,   10,   97111,
     10,   32115,   10,   32110115,   10116,  -61,   10,  -77,
     10,   10110,   10,   98,   99,   10111,   10122,   10111,
     10,   32,   10100,   10111,   10,   32,   10101,   10115,
     10,   99,   10101,   10110,   10,   97,   10114,   10105,
     10111,   10111,   10103,   10,   97,   10105,   10115,
     10101,   10114,    0
  };
}

private static final byte _lexer_trans_keys[] = init__lexer_trans_keys_0();


private static byte[] init__lexer_single_lengths_0()
{
  return new byte [] {
      0,   15,    1,    1,   14,    1,    1,    2,    2,    3,    3,    3,
      3,    2,    2,    2,    1,    1,    1,    1,    1,    1,    1,    1,
      1,    1,    1,    1,    1,    1,    1,    1,    2,    2,    3,    5,
      3,    2,    2,    1,    1,    1,    1,    1,    1,    1,    1,    1,
      1,    1,    1,    1,    1,    1,    1,    1,    7,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    3,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,   14,    1,    1,    2,    2,    4,    1,    1,    1,    1,
      2,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
      1,    1,    1,    1,    1,    1,    1,    1,   12,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    3,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    3,    3,    4,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    1,    1,    1,    1,    1,    1,    1,    1,
      1,   12,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    3,    3,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    3,    3,    4,    2,    2,    2,
      2,    3,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      1,    1,    1,    1,    1,    1,    1,    1,    1,    5,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    1,    1,    1,    1,    1,    1,    1,    2,    4,    3,    2,
      4,   14,    2,    2,    2,    2,    2,    2,    3,    3,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    1,    1,    1,    1,    1,
      1,    1,    1,    1,   12,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    3,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    3,    3,    4,    2,    2,    2,    2,    3,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    0
  };
}

private static final byte _lexer_single_lengths[] = init__lexer_single_lengths_0();


private static byte[] init__lexer_range_lengths_0()
{
  return new byte [] {
      0,    1,    0,    0,    1,    0,    0,    0,    0,    1,    1,    1,
      1,    1,    1,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,    1,
      1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    1,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    1,    1,    0,    0,
      1,    1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    1,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0
  };
}

private static final byte _lexer_range_lengths[] = init__lexer_range_lengths_0();


private static short[] init__lexer_index_offsets_0()
{
  return new short [] {
      0,    0,   17,   19,   21,   37,   39,   41,   44,   47,   52,   57,
     62,   67,   71,   75,   78,   80,   82,   84,   86,   88,   90,   92,
     94,   96,   98100102104106108110113116121,
    128133136139141143145147149151153155,
    157159161163165167169171173182185188,
    191194197200203206209212215218221224,
    228231234237240243246249252255258261,
    264267270286288290293296301303305307,
    309312314316318320322324326328330332,
    334336338340342344346348350364367370,
    373376379382385388391394397400403406,
    409412416419422425428431434437440443,
    446449452455458461464467471475480483,
    486489492495498501504507510513516519,
    522525528531534536538540542544546548,
    550552566569572575578581584587590593,
    596599602605608611615619622625628631,
    634637640643646649652655658661664667,
    670673676679682685688692696701704707,
    710713717720723726729732735738741744,
    747750753756759762765768771774777780,
    783785787789791793795797799801808811,
    814817820823826829832835838841844847,
    850853855857859861863865867871877881,
    884890906909912915918921924928932935,
    938941944947950953956959962965968971,
    974977980983986989992995997999, 1001, 1003,
   1005, 1007, 1009, 1011, 1013, 1027, 1030, 1033, 1036, 1039, 1042, 1045,
   1048, 1051, 1054, 1057, 1060, 1063, 1066, 1069, 1072, 1075, 1079, 1082,
   1085, 1088, 1091, 1094, 1097, 1100, 1103, 1106, 1109, 1112, 1115, 1118,
   1121, 1124, 1127, 1130, 1134, 1138, 1143, 1146, 1149, 1152, 1155, 1159,
   1162, 1165, 1168, 1171, 1174, 1177, 1180, 1183, 1186, 1189, 1192, 1195,
   1198, 1201, 1204, 1207, 1210, 1213, 1216, 1219, 1222, 1225, 1228
  };
}

private static final short _lexer_index_offsets[] = init__lexer_index_offsets_0();


private static short[] init__lexer_indicies_0()
{
  return new short [] {
      1,    3,    2,    4,    5,    6,    7,    8,    9,   10,   11,   12,
     13,   14,   15,    2,    0,   16,    0,    2,    0,    3,    2,    4,
      5,    6,    7,    8,    9,   10,   11,   12,   13,   14,   15,    2,
      0,   17,    0,   18,    0,   20,   21,   19,   23,   24,   22,   27,
     26,   28,   26,   25,   31,   30,   32,   30,   29,   31,   30,   33,
     30,   29,   31,   30,   34,   30,   29,   36,   35,   35,    0,    3,
     37,   37,    0,   39,   40,   38,    3,    0,   41,    0,   42,    0,
     43,    0,   44,    0,   45,    0,   46,    0,   47,    0,   48,    0,
     49,    0,   50,    0,   51,    0,   52,    0,   53,    0,   54,    0,
     55,    0,   57,   58,   56,   60,   61,   59,    0,    0,    0,    0,
     62,   63,   64,   63,   63,   66,   65,   62,    3,   67,    8,   67,
      0,   68,   69,    0,   70,   71,    0,   72,    0,   73,    0,   74,
      0,   75,    0,   76,    0,   77,    0,   78,    0,   79,    0,   80,
      0,   81,    0,   82,    0,   83,    0,   84,    0,   85,    0,   86,
      0,   88,   87,   90,   89,   90,   91,   92,   93,   92,   94,   95,
     91,   89,   90,   96,   89,   90,   97,   89,   90,   98,   89,   90,
     99,   89,   90100,   89,   90101,   89,   90102,   89,   90,
    103,   89,   90104,   89,   90105,   89,   90106,   89,   90,
    107,   89,   90108,   89,   90109,   89,   90110111,   89,
     90112,   89,   90113,   89,   90114,   89,   90115,   89,
     90116,   89,   90117,   89118,   90,   89119,   90,   89,
     90120,   89,   90121,   89,   90122,   89,   90123,   89,
     90124,   89,   90125,   89127126128129130131,
    132133134135136137138139126,    0140,    0,
    141,    0142142,    0,   55,   73,    0,   55143144145,
      0146,    0147,    0148,    0,   73,    0149150,    0,
    151,    0152,    0153,    0154,    0155,    0156,    0,
    157,    0158,    0159,    0160,    0161,    0162,    0,
    163,    0164,    0165,    0166,    0167,    0169168,
    171170171172173174175173176177178179,
    180181172170171182170171183170171184,
    170171185170171186170171187170171188,
    170171189170171190170171191170171192,
    170171193170171194170171195170171196,
    170171197170171198199170171200170171,
    201170171202170171203170171204170171,
    205170171206170207171170208171170171,
    209170171210170171211170171212170171,
    213170171196170171214170171215170171,
    216216170171196201170171196217218170,
    171219170220171170221171170171201170,
    171222170171223170171224170171225170,
    171226170171227170171213170171228170,
    171200170171229170171230170171201170,
    171231170171200170232,    0233,    0234,    0,
    235,    0236,    0237,    0238,    0240239242241,
    242243244245246244247248249250251252,
    243241242253241242254241242255241242,
    256241242257241242258241242259241242,
    260241242261241242262241242263241242,
    264241242265241242266241242267241242,
    268269241242270271241242272241242273,
    241242274241242275241242276241242277,
    241242278241279242241280242241242281,
    241242282241242283241242284241242285,
    241242267241242286241242287241242288,
    241242289241242290241242285241242291,
    241242292241242293293241242267273241,
    242267294295241242296241297242241298,
    242241242273241242299300241242301241,
    242302241242303241242304241242305241,
    242306241242307241242308241242309241,
    242300241242310241242311241242312241,
    242313241242290241242314241242272241,
    242315241242316241242273241242317241,
    242272241318,    0319,    0320,    0321,    0322,
      0323,    0324,    0326325328327328329330,
    331330329327328332327328333327328334,
    327328335327328336327328337327328338,
    327339328327340328327328341327328342,
    327328343327328344327328345327328346,
    327347,    0,   72,    0348,    0349,    0,   73,    0350,
      0,   72,    0351352351,    0355354356357354,
    353,    0359360358,    0359358355361359360,
    361358355362363364365366367368369370,
    371372373374362,    0,   90375,   89,   90376,   89,
     90377,   89,   90378,   89,   90379,   89,   90124,   89,
     90380381,   89,   90382383,   89,   90384,   89,   90,
    385,   89,   90386,   89,   90387,   89,   90388,   89,   90,
    389,   89,   90390,   89,   90391,   89,   90392,   89,   90,
    383,   89,   90393,   89,   90394,   89,   90395,   89,   90,
    396,   89,   90379,   89,   90397,   89,   90398,   89,   90,
    399,   89,   90400,   89,   90401,   89,   90124,   89402,
      0403,    0404,    0405,    0406,    0407,    0408,
      0410409412411412413414415416414417,
    418419420421422413411412423411412424,
    411412425411412426411412427411412428,
    411412429411412430411412431411412432,
    411412433411412434411412435411412436,
    411412437411412438411412439440411412,
    441411412442411412443411412444411412,
    445411412446411412447411448412411449,
    412411412450411412451411412452411412,
    453411412454411412437411412455411412,
    456411412457457411412437442411412437,
    458459411412460411461412411462412411,
    412442411412463464411412465411412466,
    411412467411412468411412469411412470,
    411412471411412472411412473411412464,
    411412474411412475411412476411412477,
    411412478411412454411412479411412441,
    411412480411412481411412442411412482,
    411412441411483,    0
  };
}

private static final short _lexer_indicies[] = init__lexer_indicies_0();


private static short[] init__lexer_trans_targs_0()
{
  return new short [] {
      0,    2,    4,    4,    5,   15,   17,   31,   34,   37,   87,   91,
    277279282284,    3,    6,    7,    8,    9,    8,    8,    9,
      8,   10,   10,   10,   11,   10,   10,   10,   11,   12,   13,   14,
      4,   14,   15,    4,   16,   18,   19,   20,   21,   22,   23,   24,
     25,   26,   27,   28,   29,   30394,   32,   33,    4,   16,   33,
      4,   16,   35,   36,    4,   35,   34,   36,   38319,   39,   41,
     40,   31,   42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
     52,   53,   54,   55,   56,   55,   56,   56,    4,   57,   71296,
     58,   59,   60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
     70,    4,   72290,   73,   74,   75,   76,   77,   78,   79,   80,
     81,   82,   83,   84,   85,   86,    4,    4,    5,   15,   17,   31,
     34,   37,   87,   91277279282284,   88,   89,   90,   92,
     96252,   93,   94,   95,   97172,   98,   99100101102,
    103104105106107108109110111112113114,
    115116115116116,    4117131132149153165,
    167170118119120121122123124125126127,
    128129130,    4,   86133134136135131137138,
    139140141142143144145146147148150151,
    152154158155156157159160161162163164,
    166168169171173174175176177178179180,
    181180181181,    4182196197220224245247,
    250183184185186187188189190191192193,
    194195,    4,   86198214199201200196202203,
    204205206207208209210211212213215216,
    217218219221222223225229226227228230,
    240231232233234235236237238239241242,
    243244246248249251253254255256257258,
    259260261260261261,    4262263264265266,
    267268269270271272273274275276,   86278,
    280281283284285286288289287285286287,
    285288289,    5,   15,   17,   31,   34,   37,   87,   91277,
    279282284291292293294295297313298308,
    299300301302303304305306307309310311,
    312314315316317318320321322323324325,
    326327328327328328,    4329343344361365,
    387389392330331332333334335336337338,
    339340341342,    4,   86345346348347343349,
    350351352353354355356357358359360362,
    363364366370367368369371381372373374,
    375376377378379380382383384385386388,
    390391393,    0
  };
}

private static final short _lexer_trans_targs[] = init__lexer_trans_targs_0();


private static short[] init__lexer_trans_actions_0()
{
  return new short [] {
     43,    0,    0,   54,    3,    1,    0,   29,    1,   29,   29,   29,
     29,   29,   29,   35,    0,    0,    0,    7139,   48,    0102,
      9,    5,   45134,   45,    0,   33122,   33,   33,    0,   11,
    106,    0,    0114,   25,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,   57149126,    0,
    110,   23,    0,   27118,   27,   51,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,   57144,    0,   54,    0,   69,   33,   84,   84,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,   13,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,   13,   31130,   60,   57,   31,   63,
     57,   63,   63,   63,   63,   63,   63,   66,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     57144,    0,   54,    0,   78,   33,   84,   84,   84,   84,   84,
     84,   84,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,   19,   19,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,   57,
    144,    0,   54,    0,   75,   33,   84,   84,   84,   84,   84,   84,
     84,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,   17,   17,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,   57144,    0,   54,    0,   81,   84,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,   21,    0,
      0,    0,    0,    0,    0,   37,   37,   54,   37,   87,    0,    0,
     39,    0,    0,   93,   90,   41,   96,   90,   96,   96,   96,   96,
     96,   96,   99,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,   57144,    0,   54,    0,   72,   33,   84,   84,   84,   84,
     84,   84,   84,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,   15,   15,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
      0,    0,    0,    0
  };
}

private static final short _lexer_trans_actions[] = init__lexer_trans_actions_0();


private static short[] init__lexer_eof_actions_0()
{
  return new short [] {
      0,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
     43,   43,   43,   43,   43,   43,   43,   43,   43,   43,   43
  };
}

private static final short _lexer_eof_actions[] = init__lexer_eof_actions_0();


static final int lexer_start = 1;
static final int lexer_first_final = 394;

static final int lexer_en_main = 1;


// line 159 "ragel/i18n/gl.java.rl"

  public void scan(String source)  {
    String input = source + "\n%_FEATURE_END_%";
    byte[] data = null;
    try {
      data = input.getBytes("UTF-8");
    } catch(UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
    int cs, p = 0, pe = data.length;
    int eof = pe;

    int lineNumber = 1;
    int lastNewline = 0;

    int contentStart = -1;
    int currentLine = -1;
    int docstringContentTypeStart = -1;
    int docstringContentTypeEnd = -1;
    int startCol = -1;
    int nextKeywordStart = -1;
    int keywordStart = -1;
    String keyword = null;
    List<String> currentRow = null;

   
// line 585 "java/src/main/java/gherkin/lexer/Gl.java"
  {
  cs = lexer_start;
  }

// line 185 "ragel/i18n/gl.java.rl"
   
// line 592 "java/src/main/java/gherkin/lexer/Gl.java"
  {
  int _klen;
  int _trans = 0;
  int _acts;
  int _nacts;
  int _keys;
  int _goto_targ = 0;

  _goto: while (true) {
  switch ( _goto_targ ) {
  case 0:
  if ( p == pe ) {
    _goto_targ = 4;
    continue _goto;
  }
  if ( cs == 0 ) {
    _goto_targ = 5;
    continue _goto;
  }
case 1:
  _match: do {
  _keys = _lexer_key_offsets[cs];
  _trans = _lexer_index_offsets[cs];
  _klen = _lexer_single_lengths[cs];
  if ( _klen > 0 ) {
    int _lower = _keys;
    int _mid;
    int _upper = _keys + _klen - 1;
    while (true) {
      if ( _upper < _lower )
        break;

      _mid = _lower + ((_upper-_lower) >> 1);
      if ( data[p] < _lexer_trans_keys[_mid] )
        _upper = _mid - 1;
      else if ( data[p] > _lexer_trans_keys[_mid] )
        _lower = _mid + 1;
      else {
        _trans += (_mid - _keys);
        break _match;
      }
    }
    _keys += _klen;
    _trans += _klen;
  }

  _klen = _lexer_range_lengths[cs];
  if ( _klen > 0 ) {
    int _lower = _keys;
    int _mid;
    int _upper = _keys + (_klen<<1) - 2;
    while (true) {
      if ( _upper < _lower )
        break;

      _mid = _lower + (((_upper-_lower) >> 1) & ~1);
      if ( data[p] < _lexer_trans_keys[_mid] )
        _upper = _mid - 2;
      else if ( data[p] > _lexer_trans_keys[_mid+1] )
        _lower = _mid + 2;
      else {
        _trans += ((_mid - _keys)>>1);
        break _match;
      }
    }
    _trans += _klen;
  }
  } while (false);

  _trans = _lexer_indicies[_trans];
  cs = _lexer_trans_targs[_trans];

  if ( _lexer_trans_actions[_trans] != 0 ) {
    _acts = _lexer_trans_actions[_trans];
    _nacts = (int) _lexer_actions[_acts++];
    while ( _nacts-- > 0 )
  {
      switch ( _lexer_actions[_acts++] )
      {
  case 0:
// line 16 "ragel/i18n/gl.java.rl"
  {
      contentStart = p;
      currentLine = lineNumber;
      if(keyword != null) {
        startCol = p - lastNewline - (keyword.length() + 1);
      }
    }
  break;
  case 1:
// line 24 "ragel/i18n/gl.java.rl"
  {
      currentLine = lineNumber;
      startCol = p - lastNewline;
    }
  break;
  case 2:
// line 29 "ragel/i18n/gl.java.rl"
  {
      contentStart = p;
    }
  break;
  case 3:
// line 33 "ragel/i18n/gl.java.rl"
  {
      docstringContentTypeStart = p;
    }
  break;
  case 4:
// line 37 "ragel/i18n/gl.java.rl"
  {
      docstringContentTypeEnd = p;
    }
  break;
  case 5:
// line 41 "ragel/i18n/gl.java.rl"
  {
      String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replace("\\\"\\\"\\\"", "\"\"\""));
      String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
      listener.docString(conType, con, currentLine);
    }
  break;
  case 6:
// line 47 "ragel/i18n/gl.java.rl"
  {
      String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
      listener.feature(keyword, nameDescription[0], nameDescription[1], currentLine);
      if(nextKeywordStart != -1) p = nextKeywordStart - 1;
      nextKeywordStart = -1;
    }
  break;
  case 7:
// line 54 "ragel/i18n/gl.java.rl"
  {
      String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
      listener.background(keyword, nameDescription[0], nameDescription[1], currentLine);
      if(nextKeywordStart != -1) p = nextKeywordStart - 1;
      nextKeywordStart = -1;
    }
  break;
  case 8:
// line 61 "ragel/i18n/gl.java.rl"
  {
      String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
      listener.scenario(keyword, nameDescription[0], nameDescription[1], currentLine);
      if(nextKeywordStart != -1) p = nextKeywordStart - 1;
      nextKeywordStart = -1;
    }
  break;
  case 9:
// line 68 "ragel/i18n/gl.java.rl"
  {
      String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
      listener.scenarioOutline(keyword, nameDescription[0], nameDescription[1], currentLine);
      if(nextKeywordStart != -1) p = nextKeywordStart - 1;
      nextKeywordStart = -1;
    }
  break;
  case 10:
// line 75 "ragel/i18n/gl.java.rl"
  {
      String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
      listener.examples(keyword, nameDescription[0], nameDescription[1], currentLine);
      if(nextKeywordStart != -1) p = nextKeywordStart - 1;
      nextKeywordStart = -1;
    }
  break;
  case 11:
// line 82 "ragel/i18n/gl.java.rl"
  {
      listener.step(keyword, substring(data, contentStart, p).trim(), currentLine);
    }
  break;
  case 12:
// line 86 "ragel/i18n/gl.java.rl"
  {
      listener.comment(substring(data, contentStart, p).trim(), lineNumber);
      keywordStart = -1;
    }
  break;
  case 13:
// line 91 "ragel/i18n/gl.java.rl"
  {
      listener.tag(substring(data, contentStart, p).trim(), currentLine);
      keywordStart = -1;
    }
  break;
  case 14:
// line 96 "ragel/i18n/gl.java.rl"
  {
      lineNumber++;
    }
  break;
  case 15:
// line 100 "ragel/i18n/gl.java.rl"
  {
      lastNewline = p + 1;
    }
  break;
  case 16:
// line 104 "ragel/i18n/gl.java.rl"
  {
      if(keywordStart == -1) keywordStart = p;
    }
  break;
  case 17:
// line 108 "ragel/i18n/gl.java.rl"
  {
      keyword = substring(data, keywordStart, p).replaceFirst(":$","");
      keywordStart = -1;
    }
  break;
  case 18:
// line 113 "ragel/i18n/gl.java.rl"
  {
      nextKeywordStart = p;
    }
  break;
  case 19:
// line 117 "ragel/i18n/gl.java.rl"
  {
      p = p - 1;
      currentRow = new ArrayList<String>();
      currentLine = lineNumber;
    }
  break;
  case 20:
// line 123 "ragel/i18n/gl.java.rl"
  {
      contentStart = p;
    }
  break;
  case 21:
// line 127 "ragel/i18n/gl.java.rl"
  {
      String con = substring(data, contentStart, p).trim();
      currentRow.add(con
        .replace("\\|", "|")
        .replace("\\n", "\n")
        .replace("\\\\", "\\")
      );
    }
  break;
  case 22:
// line 136 "ragel/i18n/gl.java.rl"
  {
      listener.row(currentRow, currentLine);
    }
  break;
  case 23:
// line 140 "ragel/i18n/gl.java.rl"
  {
      if(cs < lexer_first_final) {
        String content = currentLineContent(data, lastNewline);
        throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
      } else {
        listener.eof();
      }
    }
  break;
// line 853 "java/src/main/java/gherkin/lexer/Gl.java"
      }
    }
  }

case 2:
  if ( cs == 0 ) {
    _goto_targ = 5;
    continue _goto;
  }
  if ( ++p != pe ) {
    _goto_targ = 1;
    continue _goto;
  }
case 4:
  if ( p == eof )
  {
  int __acts = _lexer_eof_actions[cs];
  int __nacts = (int) _lexer_actions[__acts++];
  while ( __nacts-- > 0 ) {
    switch ( _lexer_actions[__acts++] ) {
  case 23:
// line 140 "ragel/i18n/gl.java.rl"
  {
      if(cs < lexer_first_final) {
        String content = currentLineContent(data, lastNewline);
        throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
      } else {
        listener.eof();
      }
    }
  break;
// line 885 "java/src/main/java/gherkin/lexer/Gl.java"
    }
  }
  }

case 5:
  }
  break; }
  }

// line 186 "ragel/i18n/gl.java.rl"
  }

  private String keywordContent(byte[] data, int p, int eof, int nextKeywordStart, int contentStart) {
    int endPoint = (nextKeywordStart == -1 || (p == eof)) ? p : nextKeywordStart;
    return substring(data, contentStart, endPoint);
  }

  private String[] nameAndUnindentedDescription(int startCol, String text) {
    String[] lines = text.split("\n");
    String name = lines.length > 0 ? lines[0].trim() : "";
    StringBuffer description = new StringBuffer();
    for(int i = 1; i < lines.length; i++) {
      description.append(lines[i]);
      description.append("\n");
    }
    return new String[]{name, unindent(startCol+2, description.toString()).replaceAll("\\s+$", "")};
  }

  private String unindent(int startCol, String text) {
    return Pattern.compile("^[\t ]{0," + startCol + "}", Pattern.MULTILINE).matcher(text).replaceAll("");
  }

  private String currentLineContent(byte[] data, int lastNewline) {
    return substring(data, lastNewline, data.length).trim();
  }

  private String substring(byte[] data, int start, int end) {
    try {
      return new String(data, start, end-start, "utf-8");
    } catch(java.io.UnsupportedEncodingException e) {
      throw new RuntimeException("Internal error", e);
    }
  }
}
TOP

Related Classes of gherkin.lexer.Gl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.