flag.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <regex>
5
6#include "frontend/common.hpp"
8
9namespace by {
10
11 struct cli;
12
13 typedef std::vector<std::string> strings;
14
15 class flag: public instance {
16 BY(ADT(flag, instance))
17
18 public:
19 enum res {
20 MATCH,
21 EXIT_PROGRAM,
22 NOT_MATCH
23 };
24
25 public:
26 virtual const nchar* getName() const = 0;
27 virtual const nchar* getDescription() const = 0;
28
30 virtual res take(interpreter& ip, starter& s, cli& c, flagArgs& a) const;
31
32 protected:
35 virtual ncnt _onContinuousArgCount() const;
36
37 void _delArgs(flagArgs& a, std::vector<int> indices) const;
38
39 virtual const strings& _getRegExpr() const = 0;
40 virtual res _onTake(const flagArgs& tray, cli& c, interpreter& ip, starter& s) const = 0;
41 };
42
43 typedef std::vector<tstr<flag>> flags;
44}
Definition: flag.hpp:15
virtual ncnt _onContinuousArgCount() const
virtual res take(interpreter &ip, starter &s, cli &c, flagArgs &a) const
Base class for all managed instances in memlite system.
Definition: instance.hpp:20
High-level interpreter for byeol language.
Definition: interpreter.hpp:13
Program execution starter.
Definition: starter.hpp:14
Command-line interface for byeol language system.
Definition: cli.hpp:12