From 6460ef77bcceb17d80d1b46a07b28fada19737c8 Mon Sep 17 00:00:00 2001
From: take_cheeze <takechi101010@gmail.com>
Date: Mon, 6 Apr 2015 15:20:13 +0900
Subject: Compile mruby compiler as mrbgem. Compiler codes is moved to
 "mruby-compiler". Executable `mrbc` is moved to "mruby-bin-mrbc".

---
 mrbgems/mruby-compiler/core/lex.def | 212 ++++++++++++++++++++++++++++++++++++
 1 file changed, 212 insertions(+)
 create mode 100644 mrbgems/mruby-compiler/core/lex.def

(limited to 'mrbgems/mruby-compiler/core/lex.def')

diff --git a/mrbgems/mruby-compiler/core/lex.def b/mrbgems/mruby-compiler/core/lex.def
new file mode 100644
index 000000000..ea456a843
--- /dev/null
+++ b/mrbgems/mruby-compiler/core/lex.def
@@ -0,0 +1,212 @@
+/* ANSI-C code produced by gperf version 3.0.3 */
+/* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' src/keywords  */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+      && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+      && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+      && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+      && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+      && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+      && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+      && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+      && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+      && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+      && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+      && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+      && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+      && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+      && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+      && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+      && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+      && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+      && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+      && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+      && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+      && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+      && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646.  */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+#endif
+
+#line 1 "src/keywords"
+
+struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;};
+const struct kwtable *mrb_reserved_word(const char *, unsigned int);
+static const struct kwtable *reserved_word(const char *, unsigned int);
+#define mrb_reserved_word(str, len) reserved_word(str, len)
+#line 8 "src/keywords"
+struct kwtable;
+
+#define TOTAL_KEYWORDS 40
+#define MIN_WORD_LENGTH 2
+#define MAX_WORD_LENGTH 12
+#define MIN_HASH_VALUE 8
+#define MAX_HASH_VALUE 50
+/* maximum key range = 43, duplicates = 0 */
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash (register const char *str, register unsigned int len)
+{
+  static const unsigned char asso_values[] =
+    {
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 14, 51, 16,  8,
+      11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 11, 51, 13,  1, 26,
+       4,  1,  8, 28, 51, 23, 51,  1,  1, 27,
+       5, 19, 21, 51,  8,  3,  3, 11, 51, 21,
+      24, 16, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+      51, 51, 51, 51, 51, 51
+    };
+  register int hval = len;
+
+  switch (hval)
+    {
+      default:
+        hval += asso_values[(unsigned char)str[2]];
+      /*FALLTHROUGH*/
+      case 2:
+      case 1:
+        hval += asso_values[(unsigned char)str[0]];
+        break;
+    }
+  return hval + asso_values[(unsigned char)str[len - 1]];
+}
+
+#ifdef __GNUC__
+__inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
+#endif
+const struct kwtable *
+mrb_reserved_word (register const char *str, register unsigned int len)
+{
+  static const struct kwtable wordlist[] =
+    {
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+#line 18 "src/keywords"
+      {"break",        {keyword_break,       keyword_break},       EXPR_MID},
+#line 23 "src/keywords"
+      {"else",         {keyword_else,        keyword_else},        EXPR_BEG},
+#line 33 "src/keywords"
+      {"nil",          {keyword_nil,         keyword_nil},         EXPR_END},
+#line 26 "src/keywords"
+      {"ensure",       {keyword_ensure,      keyword_ensure},      EXPR_BEG},
+#line 25 "src/keywords"
+      {"end",          {keyword_end,         keyword_end},         EXPR_END},
+#line 42 "src/keywords"
+      {"then",         {keyword_then,        keyword_then},        EXPR_BEG},
+#line 34 "src/keywords"
+      {"not",          {keyword_not,         keyword_not},         EXPR_ARG},
+#line 27 "src/keywords"
+      {"false",        {keyword_false,       keyword_false},       EXPR_END},
+#line 40 "src/keywords"
+      {"self",         {keyword_self,        keyword_self},        EXPR_END},
+#line 24 "src/keywords"
+      {"elsif",        {keyword_elsif,       keyword_elsif},       EXPR_VALUE},
+#line 37 "src/keywords"
+      {"rescue",       {keyword_rescue,      modifier_rescue},     EXPR_MID},
+#line 43 "src/keywords"
+      {"true",         {keyword_true,        keyword_true},        EXPR_END},
+#line 46 "src/keywords"
+      {"until",        {keyword_until,       modifier_until},      EXPR_VALUE},
+#line 45 "src/keywords"
+      {"unless",       {keyword_unless,      modifier_unless},     EXPR_VALUE},
+#line 39 "src/keywords"
+      {"return",       {keyword_return,      keyword_return},      EXPR_MID},
+#line 21 "src/keywords"
+      {"def",          {keyword_def,         keyword_def},         EXPR_FNAME},
+#line 16 "src/keywords"
+      {"and",          {keyword_and,         keyword_and},         EXPR_VALUE},
+#line 22 "src/keywords"
+      {"do",           {keyword_do,          keyword_do},          EXPR_BEG},
+#line 49 "src/keywords"
+      {"yield",        {keyword_yield,       keyword_yield},       EXPR_ARG},
+#line 28 "src/keywords"
+      {"for",          {keyword_for,         keyword_for},         EXPR_VALUE},
+#line 44 "src/keywords"
+      {"undef",        {keyword_undef,       keyword_undef},       EXPR_FNAME},
+#line 35 "src/keywords"
+      {"or",           {keyword_or,          keyword_or},          EXPR_VALUE},
+#line 30 "src/keywords"
+      {"in",           {keyword_in,          keyword_in},          EXPR_VALUE},
+#line 47 "src/keywords"
+      {"when",         {keyword_when,        keyword_when},        EXPR_VALUE},
+#line 38 "src/keywords"
+      {"retry",        {keyword_retry,       keyword_retry},       EXPR_END},
+#line 29 "src/keywords"
+      {"if",           {keyword_if,          modifier_if},         EXPR_VALUE},
+#line 19 "src/keywords"
+      {"case",         {keyword_case,        keyword_case},        EXPR_VALUE},
+#line 36 "src/keywords"
+      {"redo",         {keyword_redo,        keyword_redo},        EXPR_END},
+#line 32 "src/keywords"
+      {"next",         {keyword_next,        keyword_next},        EXPR_MID},
+#line 41 "src/keywords"
+      {"super",        {keyword_super,       keyword_super},       EXPR_ARG},
+#line 31 "src/keywords"
+      {"module",       {keyword_module,      keyword_module},      EXPR_VALUE},
+#line 17 "src/keywords"
+      {"begin",        {keyword_begin,       keyword_begin},       EXPR_BEG},
+#line 12 "src/keywords"
+      {"__LINE__",     {keyword__LINE__,     keyword__LINE__},     EXPR_END},
+#line 11 "src/keywords"
+      {"__FILE__",     {keyword__FILE__,     keyword__FILE__},     EXPR_END},
+#line 10 "src/keywords"
+      {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
+#line 14 "src/keywords"
+      {"END",          {keyword_END,         keyword_END},         EXPR_END},
+#line 15 "src/keywords"
+      {"alias",        {keyword_alias,       keyword_alias},       EXPR_FNAME},
+#line 13 "src/keywords"
+      {"BEGIN",        {keyword_BEGIN,       keyword_BEGIN},       EXPR_END},
+      {""},
+#line 20 "src/keywords"
+      {"class",        {keyword_class,       keyword_class},       EXPR_CLASS},
+      {""}, {""},
+#line 48 "src/keywords"
+      {"while",        {keyword_while,       modifier_while},      EXPR_VALUE}
+    };
+
+  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+    {
+      register int key = hash (str, len);
+
+      if (key <= MAX_HASH_VALUE && key >= 0)
+        {
+          register const char *s = wordlist[key].name;
+
+          if (*str == *s && !strcmp (str + 1, s + 1))
+            return &wordlist[key];
+        }
+    }
+  return 0;
+}
+#line 50 "src/keywords"
+
-- 
cgit v1.2.3


From 2f635f56cb701293c59cc2e4f41b653cae2cb3af Mon Sep 17 00:00:00 2001
From: "Yukihiro \"Matz\" Matsumoto" <matz@ruby-lang.org>
Date: Mon, 1 Jun 2015 21:57:53 +0900
Subject: update lex.def using gperf 3.0.4

---
 mrbgems/mruby-compiler/core/lex.def | 92 ++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

(limited to 'mrbgems/mruby-compiler/core/lex.def')

diff --git a/mrbgems/mruby-compiler/core/lex.def b/mrbgems/mruby-compiler/core/lex.def
index ea456a843..58e302965 100644
--- a/mrbgems/mruby-compiler/core/lex.def
+++ b/mrbgems/mruby-compiler/core/lex.def
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' src/keywords  */
+/* ANSI-C code produced by gperf version 3.0.4 */
+/* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' /home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -28,13 +28,13 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
 #endif
 
-#line 1 "src/keywords"
+#line 1 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
 
 struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;};
 const struct kwtable *mrb_reserved_word(const char *, unsigned int);
 static const struct kwtable *reserved_word(const char *, unsigned int);
 #define mrb_reserved_word(str, len) reserved_word(str, len)
-#line 8 "src/keywords"
+#line 8 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
 struct kwtable;
 
 #define TOTAL_KEYWORDS 40
@@ -100,7 +100,7 @@ hash (register const char *str, register unsigned int len)
 
 #ifdef __GNUC__
 __inline
-#ifdef __GNUC_STDC_INLINE__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
@@ -110,87 +110,87 @@ mrb_reserved_word (register const char *str, register unsigned int len)
   static const struct kwtable wordlist[] =
     {
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
-#line 18 "src/keywords"
+#line 18 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"break",        {keyword_break,       keyword_break},       EXPR_MID},
-#line 23 "src/keywords"
+#line 23 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"else",         {keyword_else,        keyword_else},        EXPR_BEG},
-#line 33 "src/keywords"
+#line 33 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"nil",          {keyword_nil,         keyword_nil},         EXPR_END},
-#line 26 "src/keywords"
+#line 26 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"ensure",       {keyword_ensure,      keyword_ensure},      EXPR_BEG},
-#line 25 "src/keywords"
+#line 25 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"end",          {keyword_end,         keyword_end},         EXPR_END},
-#line 42 "src/keywords"
+#line 42 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"then",         {keyword_then,        keyword_then},        EXPR_BEG},
-#line 34 "src/keywords"
+#line 34 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"not",          {keyword_not,         keyword_not},         EXPR_ARG},
-#line 27 "src/keywords"
+#line 27 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"false",        {keyword_false,       keyword_false},       EXPR_END},
-#line 40 "src/keywords"
+#line 40 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"self",         {keyword_self,        keyword_self},        EXPR_END},
-#line 24 "src/keywords"
+#line 24 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"elsif",        {keyword_elsif,       keyword_elsif},       EXPR_VALUE},
-#line 37 "src/keywords"
+#line 37 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"rescue",       {keyword_rescue,      modifier_rescue},     EXPR_MID},
-#line 43 "src/keywords"
+#line 43 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"true",         {keyword_true,        keyword_true},        EXPR_END},
-#line 46 "src/keywords"
+#line 46 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"until",        {keyword_until,       modifier_until},      EXPR_VALUE},
-#line 45 "src/keywords"
+#line 45 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"unless",       {keyword_unless,      modifier_unless},     EXPR_VALUE},
-#line 39 "src/keywords"
+#line 39 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"return",       {keyword_return,      keyword_return},      EXPR_MID},
-#line 21 "src/keywords"
+#line 21 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"def",          {keyword_def,         keyword_def},         EXPR_FNAME},
-#line 16 "src/keywords"
+#line 16 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"and",          {keyword_and,         keyword_and},         EXPR_VALUE},
-#line 22 "src/keywords"
+#line 22 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"do",           {keyword_do,          keyword_do},          EXPR_BEG},
-#line 49 "src/keywords"
+#line 49 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"yield",        {keyword_yield,       keyword_yield},       EXPR_ARG},
-#line 28 "src/keywords"
+#line 28 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"for",          {keyword_for,         keyword_for},         EXPR_VALUE},
-#line 44 "src/keywords"
+#line 44 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"undef",        {keyword_undef,       keyword_undef},       EXPR_FNAME},
-#line 35 "src/keywords"
+#line 35 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"or",           {keyword_or,          keyword_or},          EXPR_VALUE},
-#line 30 "src/keywords"
+#line 30 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"in",           {keyword_in,          keyword_in},          EXPR_VALUE},
-#line 47 "src/keywords"
+#line 47 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"when",         {keyword_when,        keyword_when},        EXPR_VALUE},
-#line 38 "src/keywords"
+#line 38 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"retry",        {keyword_retry,       keyword_retry},       EXPR_END},
-#line 29 "src/keywords"
+#line 29 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"if",           {keyword_if,          modifier_if},         EXPR_VALUE},
-#line 19 "src/keywords"
+#line 19 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"case",         {keyword_case,        keyword_case},        EXPR_VALUE},
-#line 36 "src/keywords"
+#line 36 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"redo",         {keyword_redo,        keyword_redo},        EXPR_END},
-#line 32 "src/keywords"
+#line 32 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"next",         {keyword_next,        keyword_next},        EXPR_MID},
-#line 41 "src/keywords"
+#line 41 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"super",        {keyword_super,       keyword_super},       EXPR_ARG},
-#line 31 "src/keywords"
+#line 31 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"module",       {keyword_module,      keyword_module},      EXPR_VALUE},
-#line 17 "src/keywords"
+#line 17 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"begin",        {keyword_begin,       keyword_begin},       EXPR_BEG},
-#line 12 "src/keywords"
+#line 12 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"__LINE__",     {keyword__LINE__,     keyword__LINE__},     EXPR_END},
-#line 11 "src/keywords"
+#line 11 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"__FILE__",     {keyword__FILE__,     keyword__FILE__},     EXPR_END},
-#line 10 "src/keywords"
+#line 10 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
-#line 14 "src/keywords"
+#line 14 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"END",          {keyword_END,         keyword_END},         EXPR_END},
-#line 15 "src/keywords"
+#line 15 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"alias",        {keyword_alias,       keyword_alias},       EXPR_FNAME},
-#line 13 "src/keywords"
+#line 13 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"BEGIN",        {keyword_BEGIN,       keyword_BEGIN},       EXPR_END},
       {""},
-#line 20 "src/keywords"
+#line 20 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"class",        {keyword_class,       keyword_class},       EXPR_CLASS},
       {""}, {""},
-#line 48 "src/keywords"
+#line 48 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
       {"while",        {keyword_while,       modifier_while},      EXPR_VALUE}
     };
 
@@ -208,5 +208,5 @@ mrb_reserved_word (register const char *str, register unsigned int len)
     }
   return 0;
 }
-#line 50 "src/keywords"
+#line 50 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
 
-- 
cgit v1.2.3

