summaryrefslogtreecommitdiff
path: root/drivers/nrex/nrex.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nrex/nrex.hpp')
-rw-r--r--drivers/nrex/nrex.hpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/drivers/nrex/nrex.hpp b/drivers/nrex/nrex.hpp
index e26a61c39a..44e950c517 100644
--- a/drivers/nrex/nrex.hpp
+++ b/drivers/nrex/nrex.hpp
@@ -1,4 +1,5 @@
// NREX: Node RegEx
+// Version 0.1
//
// Copyright (c) 2015, Zher Huei Lee
// All rights reserved.
@@ -59,7 +60,32 @@ class nrex
int _capturing;
nrex_node* _root;
public:
+
+ /*!
+ * \brief Initialises an empty regex container
+ */
nrex();
+
+ /*!
+ * \brief Initialises and compiles the regex pattern
+ *
+ * This calls nrex::compile() with the same arguments. To check whether
+ * the compilation was successfull, use nrex::valid().
+ *
+ * If the NREX_THROW_ERROR was defined it would automatically throw a
+ * runtime error nrex_compile_error if it encounters a problem when
+ * parsing the pattern.
+ *
+ * \param pattern The regex pattern
+ * \param captures The maximum number of capture groups to allow. Any
+ * extra would be converted to non-capturing groups.
+ * If negative, no limit would be imposed. Defaults
+ * to 9.
+ *
+ * \see nrex::compile()
+ */
+ nrex(const nrex_char* pattern, int captures = 9);
+
~nrex();
/*!
@@ -78,9 +104,9 @@ class nrex
*
* This is used to provide the array size of the captures needed for
* nrex::match() to work. The size is actually the number of capture
- * groups + one for the matching of the entire pattern. The result is
- * always capped at 10 or 100, depending on the extend option given in
- * nrex::compile() (default 10).
+ * groups + one for the matching of the entire pattern. This can be
+ * capped using the extra argument given in nrex::compile()
+ * (default 10).
*
* \return The number of captures
*/
@@ -97,12 +123,13 @@ class nrex
* parsing the pattern.
*
* \param pattern The regex pattern
- * \param extended If true, raises the limit on number of capture
- * groups and back-references to 99. Otherwise limited
- * to 9. Defaults to false.
+ * \param captures The maximum number of capture groups to allow. Any
+ * extra would be converted to non-capturing groups.
+ * If negative, no limit would be imposed. Defaults
+ * to 9.
* \return True if the pattern was succesfully compiled
*/
- bool compile(const nrex_char* pattern, bool extended = false);
+ bool compile(const nrex_char* pattern, int captures = 9);
/*!
* \brief Uses the pattern to search through the provided string