Documentation Project is working well!!

This commit is contained in:
apio 2022-06-08 19:59:14 +02:00
parent 9b217037c8
commit d6daa8e5b3
3 changed files with 18 additions and 2 deletions

View File

@ -2,23 +2,34 @@
#include <string>
#include <memory>
/* Struct to represent a location in a file. */
struct Location
{
int line;
int column;
std::string fname;
/* The location at which this location was imported, for error traces in imported files. */
std::shared_ptr<Location> parent = nullptr;
/* Creates a Location with the given parameters. */
Location(int ln, int col, std::string file);
~Location();
/* Returns a string of the format FILE:LINE:COL. */
std::string to_string() const;
/* Returns a string of the format (FILE:LINE:COL). */
std::string to_parenthesized_string() const;
/* Advance to the next column in the file. */
void advance();
/* Advance to the next line if provided a newline. */
void pos_from_char(const char& character);
void operator=(const Location& other);
/* Copies the other location into this one. */
void copy(const Location& other);
};

View File

@ -1,10 +1,14 @@
// Normalizer: take token stream and remove NULL tokens + convert > and = into >= and similar
#pragma once
#include "Token.h"
#include "Lexer.h" // for TokenStream
/* Namespace to normalize a TokenStream. */
namespace Normalizer
{
/* Some tokens are difficult for the Lexer to parse right, or maybe I'm just lazy.
Anyways, this function transforms > and = tokens next to each other into a single >=, which has a different meaning, etc...
For example: = + = : ==, < + = : <=...
It also takes blank tokens and removes them. */
TokenStream normalize(const TokenStream& input);
}

View File

@ -1,4 +1,5 @@
#pragma once
#include <string>
/* Simple function to replace a substring in a string. */
bool replace(std::string& str, const std::string& from, const std::string& to);