Skip to content

Commit

Permalink
fancy codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Untitled committed Jul 27, 2020
1 parent f99b1bd commit c76b82d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files.associations": {
"stack": "cpp",
"xstring": "cpp",
"string": "cpp"
}
}
28 changes: 18 additions & 10 deletions parser.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#include "parser.h"

namespace parser
{
void FileParser::parse()
{
for (char ch : code)
{
if (ch == ' ' || ch == '\r' || ch == '\n')
continue;
if(ch=='f')
;
namespace parser{
void Parser::parse(){
std::string lastPattern;
int i = 0;
for (int i = 0; i < code.length(); i++){
char ch = code[i];
if (ch == ' ' || ch == '\r' || ch == '\n'){
if(!lastPattern.empty()){
//Throw error of invalid keyword
}
lastPattern = "";
return;
}
if ((!lastPattern.empty())&&((std::string)"function").substr(0,lastPattern.length()-1)==lastPattern){
lastPattern.push_back(ch);
}else{
//Throw error of invalid keyword
}
}
}
} // namespace parser
20 changes: 5 additions & 15 deletions parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@

namespace parser
{
class IParser{
class Parser{
private:
protected:
std::string code;
int readmode;
public:
IParser(){}
IParser(std::string c) : code(c){}
virtual ~IParser(){}
virtual void parse() = 0;
};

class FileParser : public IParser{
private:
protected:
public:
FileParser(){}
FileParser(std::string c) : IParser(c){}
virtual ~FileParser(){}
void parse();
Parser(){}
Parser(std::string c) : code(c){}
virtual ~Parser(){}
virtual void parse();
};
} // namespace parser

0 comments on commit c76b82d

Please sign in to comment.