Skip to content

Commit

Permalink
Add namespace documentation instead of using modules and tell Doxygen…
Browse files Browse the repository at this point in the history
… to ignore forward declarations
  • Loading branch information
pilif0 committed Apr 25, 2019
1 parent 40901a9 commit 078aea0
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 92 deletions.
18 changes: 5 additions & 13 deletions include/basilisk/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
#include <string>
#include <memory>

//! Abstract Syntax Tree definitions
/** \namespace basilisk::ast
* \brief Abstract Syntax Tree definitions
*
* Definitions of nodes of the Abstract Syntax Tree.
*/
namespace basilisk::ast {
/** \addtogroup AST
* \brief Abstract Syntax Tree definitions
*
* Definitions of nodes of the Abstract Syntax Tree.
*
* @{
*/

// Forward-define visitor base class
class Visitor;

Expand Down Expand Up @@ -632,10 +628,6 @@ namespace basilisk::ast {
//! Pure virtual general node visit
virtual void visit(Node &) = 0;
};

/**
* @}
*/
}

#endif //BASILISK_AST_H
4 changes: 3 additions & 1 deletion include/basilisk/AST_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include <string>
#include <sstream>

//! AST utility functions
/** \namespace basilisk::ast::util
* \brief AST utility functions
*/
namespace basilisk::ast::util {
/**
* \brief Check whether two pointers contain equal nodes
Expand Down
18 changes: 5 additions & 13 deletions include/basilisk/Codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@
#include <map>
#include <vector>

//! LLVM IR code generation
/** \namespace basilisk::codegen
* \brief LLVM IR code generation
*
* Generation of LLVM IR from the AST.
*/
namespace basilisk::codegen {
/** \addtogroup Codegen
* \brief LLVM IR code generation
*
* Generation of LLVM IR from the AST.
*
* @{
*/

/** \class NamedValues
* \brief Named values data structure capable of handling nested scopes
*
Expand Down Expand Up @@ -262,10 +258,6 @@ namespace basilisk::codegen {
//! Construct a codegen exception from its message
explicit CodegenException(const std::string &message) : std::runtime_error(message) {}
};

/**
* @}
*/
}

#endif //BASILISK_CODEGEN_H
26 changes: 10 additions & 16 deletions include/basilisk/Lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@
#include <exception>

// Forward declarations
///\cond
namespace basilisk::tokens {
struct Token;
}
///\endcond

//! Namespace for all lexer-related code
/** \namespace basilisk::lexer
* \brief Namespace for all lexer-related code
*
* The main lexing function is \ref lex.
* It needs a function to get the next input character (\ref get_function_t), a function to peek at the next input
* character (\ref peek_function_t, and a function to append a Token to the output buffer (\ref append_function_t).
* Whitespace is ignored when lexing, apart from separating tokens.
*/
namespace basilisk::lexer {
/** \addtogroup Lexer
* \brief Lexing module
*
* Module that contains any code related exclusively to lexing.
* The main lexing function is \c lex.
* It needs a function to get the next input character, and a function to append a Token to the output buffer.
* Whitespace is ignored when lexing, apart from separating tokens.
*
* @{
*/

//! Input get function type - no arguments and return a single character
typedef std::function<char ()> get_function_t;
//! Input peek function type - no arguments and return a single character
Expand All @@ -46,10 +44,6 @@ namespace basilisk::lexer {
explicit LexerException(const std::string &message) : std::runtime_error(message) {}
};

/**
* @}
*/

}

#endif //BASILISK_LEXER_H
27 changes: 10 additions & 17 deletions include/basilisk/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <memory>

// Forward declarations
///\cond
namespace basilisk::tokens {
struct Token;
}
Expand Down Expand Up @@ -40,20 +41,17 @@ namespace basilisk::ast {
}
class Program;
}
///\endcond

//! Namespace for all parser-related code
/** \namespace basilisk::parser
* \brief Namespace for all parser-related code
*
* The main parsing tool is \ref ProgramParser, which returns the parse tree resulting from consuming all tokens until
* the first \c END token.
* Each parser needs a function to get the next input token (\ref get_f_t) and a function to peek at the input tokens
* (\ref peek_f_t).
*/
namespace basilisk::parser {
/** \addtogroup Parser
* \brief Parsing module
*
* Module that contains any code related exclusively to parsing.
* The main parsing function is \c parse.
* It needs a function to get the next input token and returns the parse tree resulting from consuming all tokens
* until the first \c END token.
*
* @{
*/

/**
* \brief Input get function type
*
Expand Down Expand Up @@ -193,11 +191,6 @@ namespace basilisk::parser {
//! Construct a parser exception from its message
explicit ParserException(const std::string &message) : std::runtime_error(message) {}
};

/**
* @}
*/

}

#endif //BASILISK_PARSER_H
56 changes: 24 additions & 32 deletions include/basilisk/Tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@
#include <string>
#include <ostream>

//! Token definitions
/** \namespace basilisk::tokens
* \brief Token definitions
*
* Definitions of tokens created by the lexer and used by the parser.
*
* Tokens:
* - `IDENTIFIER` = letter followed by alphanumeric or `_`
* - `LPAR` = `(`
* - `RPAR` = `)`
* - `LBRAC` = `{`
* - `RBRAC` = `}`
* - `COMMA` = `,`
* - `SEMICOLON` = `;`
* - `ASSIGN` = `=`
* - `RETURN` = `return`
* - `DOUBLE_LITERAL` = at least one digit followed by a decimal point and then at least one digit
* - `PLUS` = `+`
* - `MINUS` = `-`
* - `STAR` = `*`
* - `SLASH` = `/`
* - `PERCENT` = `%`
* - `END` = represents the end of input
* - `ERROR` = represents a lexing error
*/
namespace basilisk::tokens {
/** \addtogroup Tokens
* \brief Token definitions
*
* Definitions of tokens created by the lexer and used by the parser.
*
* Tokens:
* - `IDENTIFIER` = letter followed by alphanumeric or `_`
* - `LPAR` = `(`
* - `RPAR` = `)`
* - `LBRAC` = `{`
* - `RBRAC` = '}`
* - `COMMA` = `,`
* - `SEMICOLON` = `;`
* - `ASSIGN` = `=`
* - `RETURN` = `return`
* - `DOUBLE_LITERAL` = at least one digit followed by a decimal point and then at least one digit
* - `PLUS` = `+`
* - `MINUS` = `-`
* - `STAR` = `*`
* - `SLASH` = `/`
* - `PERCENT` = `%`
* - `END` = represents the end of input
* - `ERROR` = represents a lexing error
* @{
*/

//! Token tags
namespace tags {
/** \enum token_tag
Expand Down Expand Up @@ -124,11 +121,6 @@ namespace basilisk::tokens {
return os;
}
};


/**
* @}
*/
}

#endif //BASILISK_TOKENS_H

0 comments on commit 078aea0

Please sign in to comment.