Пример #1
0
 public Word(String str, Kind_word kind)
 {
     this.str = str;
     this.kind = kind;
     this.format = new FormattedText(str, new System.Globalization.CultureInfo("ja"), FlowDirection.LeftToRight, FONT_FAMILY, 15.0, Brushes.Black);
     next = before = this;
 }
Пример #2
0
 public Word(char c, Kind_word kind)
     : this(c.ToString(), kind)
 {
 }
Пример #3
0
 public Word(Text text)
 {
     this.text = text;
     next = before = this;
     line = new Line(this);
     this.str = "\0";
     this.order = 0;
     this.kind = Kind_word.Start;
     text.word_count++;
     this.connect(new Word("\0", Kind_word.End));
 }
Пример #4
0
 public void string_compile(Kind_word start, Type_value type, Item item)
 {
     for (; ; )
     {
         nex();
         if (now.kind == start)
         {
             return;
         }
         else if (now.kind == Kind_word.End || now.kind == Kind_word.Break)
         {
             return;
         }
         else if (now.kind == Kind_word.Yen)
         {
             now.type = type;
             now.item = item;
             nex();
         }
         now.type = type;
         now.item = item;
     }
 }
Пример #5
0
 public void js_line_compile(Kind_word end, Kind_word finish)
 {
     if (now.kind == Kind_word.Letter)
     {
         if (now.str == "var")
         {
         }
         else if (now.str == "function")
         {
         }
         else if (now.str == "for")
         {
         }
         else if (now.str == "switch" || now.str == "while")
         {
         }
         else if (now.str == "if")
         {
         }
         else if (now.str == "do")
         {
         }
     }
     else
     {
         for (; ; )
         {
             if (now.kind == finish || now.kind == Kind_word.End)
             {
                 return;
             }
             if (now.kind == Kind_word.Plus || now.kind == Kind_word.Minus)
             {
                 if (now.next.kind == now.kind)
                 {
                     nex(); neo();
                 }
                 else throw new Exception();
             }
             else if (now.kind == Kind_word.Not)
             {
             }
             if (now.kind == Kind_word.Letter)
             {
                 neo();
                 for (; ; )
                 {
                     if (now.kind == Kind_word.Paren_left)
                     {
                     }
                     else if (now.kind == Kind_word.Bracket_left)
                     {
                     }
                     else if (now.kind == Kind_word.Dot)
                     {
                     }
                     else break;
                 }
             }
             else if (now.kind == Kind_word.Paren_left)
             {
             }
             else if (now.kind == Kind_word.Bracket_left)
             {
             }
             else if (now.kind == Kind_word.Brace_left)
             {
             }
         operate_head:
             if (now.kind == Kind_word.Equal) { }
             else if (now.kind == Kind_word.Plus || now.kind == Kind_word.Minus)
             {
                 if (now.next.kind == now.kind) goto operate_head;
             }
             else if (now.kind == Kind_word.Slash || now.kind == Kind_word.Astarisk)
             {
             }
             else if (now.kind == Kind_word.Compare_Left || now.kind == Kind_word.Compare_Right) { }
             else if (now.kind == end || now.kind == Kind_word.Comma || now.kind == Kind_word.Break) { break; }
         }
     }
 }
Пример #6
0
 public Kind_word css_value_compile(Kind_word end, Kind_word sub, Kind_word option)
 {
     for (; ; )
     {
         if (now.kind == Kind_word.Letter || now.kind == Kind_word.Minus)
         {
         head2:
             html_name_compile(Type_value.Style_value, null, Brushes.Black);
             neox();
             if (now.kind == Kind_word.Dot)
             {
                 nex();
                 goto head2;
             }
             else if (now.kind == Kind_word.Paren_left)
             {
                 neo();
                 for (; ; )
                 {
                     Kind_word kind = css_value_compile(Kind_word.Paren_right, Kind_word.None, Kind_word.None);
                     if (kind == Kind_word.Paren_right) break;
                     neox();
                 }
                 neox();
             }
         }
         else if (now.kind == Kind_word.Number || now.kind == Kind_word.Dot || now.kind == Kind_word.Minus)
         {
             if (now.kind == Kind_word.Minus) neo();
             bool dot = false;
             for (; ; )
             {
                 if (now.kind == Kind_word.Number)
                 {
                     nex();
                     if (now.kind != Kind_word.Dot) break;
                 }
                 else if (now.kind == Kind_word.Dot)
                 {
                     if (dot) throw new Exception_error();
                     else dot = true;
                     nex();
                 }
                 else throw new Exception_error();
             }
             if (now.kind == Kind_word.Letter)
             {
                 if (now.str == "em" || now.str == "px" || now.str == "%" || now.str == "pt")
                 {
                     neo();
                 }
                 else throw new Exception_error();
             }
             if (now.kind == Kind_word.Space) neo();
         }
         else if (now.kind == Kind_word.Sharp)
         {
             nex();
             if (now.kind == Kind_word.Letter || now.kind == Kind_word.Number)//16進数だから、数字と名前
             {
                 if (now.length != 3 && now.length != 6) { /*error*/}
                 neo();
             }
             else throw new Exception_error();
         }
         else if (now.kind == Kind_word.Single_quote || now.kind == Kind_word.Double_quote)
         {
             string_compile(now.kind, Type_value.Style_attribute_value, null);
             neox();
         }
         else throw new Exception_error();
         if (now.kind == Kind_word.Comma) neox();
         else if (now.kind == end) return end;
         else if (now.kind == sub) return sub;
         else if (now.kind == option) return option;
     }
 }
Пример #7
0
 public void css_comile(Kind_word end)
 {
     neox();
     for (; ; )
     {
     head:
         if (now.kind == end) return;
         String letter = null;
         Type_value type = Type_value.Style_attribute_tag;
         if (now.kind == Kind_word.Atmark)
         {
             nex();
             if ((letter = html_name_compile(Type_value.Style_attribute_option, null, Brushes.Brown)) != null)
             {
                 neox();
             }
             else throw new Exception_error();
             Kind_word kind = css_value_compile(Kind_word.Semicolon, Kind_word.Brace_right, Kind_word.Brace_left);
             if (kind == Kind_word.Brace_left)
             {
                 css_comile(Kind_word.Brace_right);
                 neox();
             }
             continue;
         }
     loop:
         if (now.kind == Kind_word.Dot)
         {
             type = Type_value.Style_attribute_class;
             now.type = type;
             nex();
         }
         else if (now.kind == Kind_word.Sharp)
         {
             type = Type_value.Style_attribute_id;
             now.type = type;
             nex();
         }
         if ((letter = html_name_compile(type, null, Brushes.Brown)) != null)
         {
             if (type == Type_value.Style_attribute_option)
             {
                 neox();
                 if (now.kind == Kind_word.Paren_left)
                 {
                     neox();
                     if (now.kind == Kind_word.Letter)
                     {
                         neox();
                     }
                     else throw new Exception_error();
                     if (now.kind == Kind_word.Paren_right)
                     {
                         neox();
                     }
                     else throw new Exception_error();
                 }
                 else if (now.kind == Kind_word.Brace_left)
                 {
                 }
             }
             else
             {
                 neox();
                 if (type == Type_value.Style_attribute_tag)
                 {
                     Tag_element tag = new Tag_element() {name = letter};
                 loop2:
                     if (now.kind == Kind_word.Bracket_left)
                     {
                         neox();
                         if ((letter = html_name_compile(Type_value.Style_attribute_att, tag, Brushes.Brown)) != null)
                         {
                             neox();
                             if (now.kind == Kind_word.Or)
                             {
                                 nex();
                                 if (now.kind == Kind_word.Equal)
                                 {
                                     neox();
                                     if (now.kind == Kind_word.Double_quote)
                                     {
                                         string_compile(now.kind, Type_value.Style_tag_attribute_value, null);
                                         neox();
                                     }
                                     else throw new Exception_error();
                                 }
                                 else throw new Exception_error();
                             }
                             else if (now.kind == Kind_word.Nyoro)
                             {
                                 nex();
                                 if (now.kind == Kind_word.Equal)
                                 {
                                     neox();
                                     if (now.kind == Kind_word.Double_quote)
                                     {
                                         string_compile(now.kind, Type_value.Style_tag_attribute_value, null);
                                         neox();
                                     }
                                     else throw new Exception_error();
                                 }
                                 else throw new Exception_error();
                             }
                             else if (now.kind == Kind_word.Equal)
                             {
                                 neox();
                                 if (now.kind == Kind_word.Double_quote)
                                 {
                                     string_compile(now.kind, Type_value.Style_tag_attribute_value, null);
                                     neox();
                                 }
                                 else throw new Exception_error();
                             }
                             if (now.kind == Kind_word.Bracket_right)
                             {
                                 neox();
                                 goto loop2;
                             }
                             else throw new Exception_error();
                         }
                     }
                 }
             }
             if (now.kind == Kind_word.Letter)
             {
                 type = Type_value.Style_attribute_tag;
                 goto loop;
             }
             else if (now.kind == Kind_word.Comma || now.kind == Kind_word.Plus || now.kind == Kind_word.Compare_Left)
             {
                 type = Type_value.Style_attribute_tag;
                 neox();
                 goto loop;
             }
             else if (now.kind == Kind_word.Colon)
             {
                 type = Type_value.Style_attribute_option;
                 neox();
                 goto loop;
             }
         }
         else throw new Exception_error();
         if (now.kind == Kind_word.Brace_left)
         {
             neox();
             for (; ; )
             {
                 if (now.kind == Kind_word.Brace_right)
                 {
                     neox();
                     goto head;
                 }
                 else if ((letter = html_name_compile(Type_value.Style_attribute_value, null, Brushes.Orange)) != null)
                 {
                     neox();
                     if (now.kind == Kind_word.Colon)
                     {
                         neox();
                     }
                     else throw new Exception_error();
                     css_value_compile(Kind_word.Semicolon, Kind_word.Brace_right, Kind_word.None);
                     if (now.kind == Kind_word.Brace_right)
                     {
                         neox();
                         goto head;
                     }
                     neox();
                 }
                 else throw new Exception_error();
             }
         }
     }
 }