summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/common.hpp14
-rw-r--r--src/parse/expr.cpp10
-rw-r--r--src/parse/lex.cpp17
-rw-r--r--src/parse/lex.hpp7
-rw-r--r--src/parse/parseerror.cpp5
-rw-r--r--src/parse/root.cpp9
6 files changed, 52 insertions, 10 deletions
diff --git a/src/parse/common.hpp b/src/parse/common.hpp
index d701f45a..0ee430af 100644
--- a/src/parse/common.hpp
+++ b/src/parse/common.hpp
@@ -1,3 +1,10 @@
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/common.hpp
+ * - Common definitions used by the parser
+ */
#ifndef PARSE_COMMON_HPP_INCLUDED
#define PARSE_COMMON_HPP_INCLUDED
#include <iostream>
@@ -18,22 +25,21 @@
} \
} while(0)
+// --- path.cpp
enum eParsePathGenericMode
{
PATH_GENERIC_NONE,
PATH_GENERIC_EXPR,
PATH_GENERIC_TYPE
};
-
-extern AST::MetaItem Parse_MetaItem(TokenStream& lex);
extern AST::Path Parse_Path(TokenStream& lex, eParsePathGenericMode generic_mode); // Auto-determines
extern AST::Path Parse_Path(TokenStream& lex, bool is_abs, eParsePathGenericMode generic_mode);
extern AST::Path Parse_PathFrom(TokenStream& lex, AST::Path src, eParsePathGenericMode generic_mode);
extern ::std::vector<TypeRef> Parse_Path_GenericList(TokenStream& lex);
-extern TypeRef Parse_Type(TokenStream& lex);
-
+extern AST::MetaItem Parse_MetaItem(TokenStream& lex);
+extern TypeRef Parse_Type(TokenStream& lex);
extern AST::Pattern Parse_Pattern(TokenStream& lex, bool is_refutable);
extern void Parse_Use(TokenStream& lex, ::std::function<void(AST::Path, ::std::string)> fcn);
diff --git a/src/parse/expr.cpp b/src/parse/expr.cpp
index 61678eea..32fd171e 100644
--- a/src/parse/expr.cpp
+++ b/src/parse/expr.cpp
@@ -1,4 +1,14 @@
/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/expr.cpp
+ * - Expression (i.e. code) parsing
+ *
+ * Start points:
+ * - Parse_ExprBlockNode : Parses a block
+ * - Parse_Stmt : Parse a single statement
+ * - Parse_Expr0 : Parse a single expression
*/
#include "parseerror.hpp"
#include "../ast/ast.hpp"
diff --git a/src/parse/lex.cpp b/src/parse/lex.cpp
index 34a2ff58..c81c3149 100644
--- a/src/parse/lex.cpp
+++ b/src/parse/lex.cpp
@@ -1,9 +1,14 @@
/*
- * "MRustC" - Primitive rust compiler in C++
- */
-/**
- * \file parse/lex.cpp
- * \brief Low-level lexer
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/lex.cpp
+ * - Lexer (converts input file to token stream)
+ *
+ * Provides:
+ * - Lexer : The file->token lexer
+ * - TTStream : A stream of tokens from a TokenTree
+ * - TokenStream : Common interface for all token streams
*/
#include "lex.hpp"
#include "tokentree.hpp"
@@ -31,7 +36,7 @@ Lexer::Lexer(::std::string filename):
#define SINGLEQUOTE -3
#define DOUBLEQUOTE -4
-// NOTE: This array must be kept reverse sorted
+// NOTE: This array must be kept sorted, or symbols are will be skipped
#define TOKENT(str, sym) {sizeof(str)-1, str, sym}
static const struct {
unsigned char len;
diff --git a/src/parse/lex.hpp b/src/parse/lex.hpp
index aa5ed623..0dab9a24 100644
--- a/src/parse/lex.hpp
+++ b/src/parse/lex.hpp
@@ -1,3 +1,10 @@
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/lex.hpp
+ * - Lexer header
+ */
#ifndef LEX_HPP_INCLUDED
#define LEX_HPP_INCLUDED
diff --git a/src/parse/parseerror.cpp b/src/parse/parseerror.cpp
index 3905ae33..01c8cced 100644
--- a/src/parse/parseerror.cpp
+++ b/src/parse/parseerror.cpp
@@ -1,4 +1,9 @@
/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/parseerror.cpp
+ * - Exceptions thrown for different types of parsing errors
*/
#include "parseerror.hpp"
#include <iostream>
diff --git a/src/parse/root.cpp b/src/parse/root.cpp
index c7518422..3bf43e1f 100644
--- a/src/parse/root.cpp
+++ b/src/parse/root.cpp
@@ -1,4 +1,13 @@
/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * parse/root.cpp
+ * - Parsing at the module level (highest-level parsing)
+ *
+ * Entrypoint:
+ * - Parse_Crate : Handles crate attrbutes, and passes on to Parse_ModRoot
+ * - Parse_ModRoot
*/
#include "../ast/ast.hpp"
#include "parseerror.hpp"