OSDN Git Service

-boolean、およびバイトベクタについて足りなかったため、実装した。
[simplecms/utakata.git] / parser.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 8c7fdaf..177cf17
@@ -1,5 +1,8 @@
 #include "parser.h"
 
+#include "lexeme.h"
+#include "lexeme_id.h"
+
 using namespace utakata;
 
 parser::Parser::Parser(const smart_ptr<lexer::Lexer>& l) : lexer_(l)
@@ -8,5 +11,37 @@ parser::Parser::Parser(const smart_ptr<lexer::Lexer>& l) : lexer_(l)
 
 bool parser::Parser::parse(smart_ptr<utf8::UTF8InputStream>& strm)
 {
+    int status = INIT;
+    lexeme::IDProxy prox;
+    smart_ptr<lexeme::ILexeme> lexm;
+    // lexeme\82ªNull\82Å\82 \82é\8fó\91Ô\82É\82È\82é\82Ü\82Å\90i\82Þ\81B
+    while (lexm = lexer_->lex(strm)) {
+        if (lexm.isNull())
+        {
+            break;
+        }
+
+        // lexeme\82ª\95Ô\82Á\82Ä\82«\82½\82ç\81A\8d\\95\92è\8b`\82É\8aY\93\96\82·\82é\82©\82Ç\82¤\82©\82ð\92²\82×\82é\81B
+        // scheme\82Ì\8d\\95\92è\8b`\82Í\83V\83\93\83v\83\8b\82©\82Â\97á\8aO\82Ì\82È\82¢\82à\82Ì\82É\82È\82Á\82Ä\82¢\82é\82½\82ß\81A
+        // \8ae\92è\8b`\82Æ\82·\82é\82Ì\82Í\8aÈ\92P\82Å\82 \82é\81B
+        if (status == INIT)
+        {
+            if (lexm->getID() == prox->openParenthesis)
+            {
+                // \8aJ\82«\8a\87\8cÊ\82Å\82 \82é\8fê\8d\87
+                status = LIST_BEGIN;
+            }
+            else if (lexm->getID() == prox->string ||
+                     lexm->getID() == prox->number ||
+                     lexm->getID() == prox->identifier ||
+                     lexm->getID() == prox->charactor ||
+                     lexm->getID() == prox->boolean)
+            {
+                // \82»\82ê\82¼\82ê\82Ì\8fê\8d\87\81Alexeme_datum\82Æ\82µ\82Ä\88µ\82í\82ê\82é\81B
+                status = LEXEME_DATUM;
+            }
+            else if
+        }
+    }
     return true;
 }