Skip to content

Commit fa6f42f

Browse files
author
Sebastiano Merlino
committed
Added some bunch of documentation
1 parent 226bfba commit fa6f42f

File tree

4 files changed

+98
-3
lines changed

4 files changed

+98
-3
lines changed

ael.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ char *p;
99
extern int yywrap(void);
1010
%}
1111

12-
COMMENT \/\/[^\n]*
12+
COMMENT \/\/[^\n]*$
1313
WORD [-a-zA-Z0-9"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9"_/.!\*\+\<\>\{\}$#\[\]]*
1414
COLLECTED_WORD (\".*\")|(\$\[[^\]]*\])
1515
VARNAME $\{[-a-zA-Z][-a-zA-Z0-9]*\}

ael.y

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ extern "C"
138138
%token LOGNOT
139139
%token LIKEOP
140140
%token CONDQUEST
141-
%token COMMENT
142141

143142
%token END 0 "end of file"
144143

@@ -163,7 +162,6 @@ object:
163162
| macro { $$ = $1; }
164163
| globals { $$ = $1; }
165164
| SEMICOLON { $$ = alloc_string((char*)";"); }
166-
| COMMENT { ;};
167165
;
168166

169167
context:

common.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,69 @@
11
#ifndef _COMMON_H_
22
#define _COMMON_H_
33

4+
/**
5+
* Method used to dynamically allocate a string.
6+
* @param d The string to allocate
7+
* @return the new pointer for the string
8+
**/
49
char* calloc_string(char* d);
510

11+
/**
12+
* Method used to destroy a dinamically allocated string previously archived
13+
* @param p The string to delete
14+
**/
615
void destroy_string(char* p);
716

17+
/**
18+
* Method used to clean the archive containing all strings dinamically allocated
19+
**/
820
void recycle_garbage();
921

22+
/**
23+
* Method used to dinamically allocate a string and store it inside temporary archive
24+
* @param d The string to allocate
25+
* @return a char pointer to the beginning od the newly allocated string
26+
**/
1027
char* alloc_string(char* d);
1128

29+
/**
30+
* Method used to concatenate two strings
31+
* @param head The beginning sting
32+
* @param tail The end string
33+
* @return a char pointer to the beginning od the newly allocated string
34+
**/
1235
char* grow_string(char* head, char* tail);
1336

37+
/**
38+
* Method used to extract the variable's name from the variable in string passed
39+
* @param c The string containing the variable
40+
* @return the variable's name extracted
41+
**/
1442
char* extract_variable(char* s);
1543

44+
/**
45+
* Method used to extract a binary expression from components
46+
* @param a The left size of the expression
47+
* @param b The symbol
48+
* @param c The right part of the expression
49+
* @return The newly created exception
50+
**/
1651
char* extract_binary_expr(char* a, char* b, char* c);
1752

53+
/**
54+
* Method used to extract a unary expression from components
55+
* @param b The symbol
56+
* @param c The right part of the expression
57+
* @return The newly created exception
58+
**/
1859
char* extract_unary_expr(char* a, char* b);
1960

61+
/**
62+
* Method used to extract a condition expression from components
63+
* @param a The left size of the expression
64+
* @param b The symbol
65+
* @param c The right part of the expression
66+
* @return The newly created exception
67+
**/
2068
char* extract_conditional_op(char* a, char* b, char* c);
2169
#endif

utilities.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,70 @@
33
#include <string>
44
#include <vector>
55

6+
/**
7+
* Method used to remove spaces preceding the string
8+
* @param the string to trim
9+
* @return the newwly created string
10+
**/
611
std::string& ltrim(std::string &s);
712

13+
/**
14+
* Method used to remove spaces following the string
15+
* @param the string to trim
16+
* @return the newwly created string
17+
**/
818
std::string& rtrim(std::string& s);
919

20+
/**
21+
* Method used to remove spaces following and preceding the string
22+
* @param the string to trim
23+
* @return the newwly created string
24+
**/
1025
std::string& trim(std::string& s);
1126

27+
/**
28+
* Split a string using the passed delimiter and put parts into the passed vector
29+
* @param s The string to split
30+
* @param delim The delimitation character
31+
* @param elems The vector to fill
32+
* @return the same vector passed in input
33+
**/
1234
std::vector<std::string>& split(const std::string& s, char delim, std::vector<std::string>& elems);
1335

36+
/**
37+
* Split a string using the given delimiter
38+
* @param s the string to split
39+
* @param delim the delimitation character
40+
* @return a vector containing all string parts
41+
**/
1442
std::vector<std::string> split(const std::string& s, char delim);
1543

44+
/**
45+
* Method used to convert a day representation from string to integer (Mon -> 1, ecc...)
46+
* @param s the string containing the day name
47+
* @return a string containing the integer represenation of the day
48+
**/
1649
std::string sday2iday(const std::string& s);
1750

51+
/**
52+
* Method used to convert a month representation from string to integer (Jun -> 6, ecc...)
53+
* @param s the string containing the month name
54+
* @return a string containing the integer represenation of the month
55+
**/
1856
std::string smonth2imonth(const std::string& s);
1957

58+
/**
59+
* Checks if the string is a valid number for the specified base
60+
* @param pszInput The input string
61+
* @param nNumberBase The numeric base used to do the check
62+
* @return true if the string is valid, false otherwise
63+
**/
2064
bool isNumeric( const char* pszInput, int nNumberBase );
2165

66+
/**
67+
* Method used to split a string using spaces as delimiters
68+
* @param s The string to split
69+
* @return a vector containing all string parts
70+
**/
2271
std::vector<std::string> string_split(const std::string& s);
2372
#endif

0 commit comments

Comments
 (0)