Permalink
Browse files

[enhance] Parser/rules: Adding Rule.eol & Rule.full_line

  • Loading branch information...
1 parent 02e4ae6 commit 5b614b7fa9ea30ac318eb0125e0202a4907de91f @akoprow akoprow committed Nov 25, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 stdlib/core/parser/rules.opa
View
10 stdlib/core/parser/rules.opa
@@ -262,6 +262,11 @@ Rule =
ws = parser white_space* -> void;
/**
+ * @return A parser recognizing end of a line
+ */
+ eol = parser [\n] -> void
+
+ /**
* A parser for a non zero number of white space character.
*
* @return parser of type [Parser.general_parser(void)]
@@ -315,6 +320,11 @@ Rule =
// FIXME: inefficient, see low level implementation of opa parser
/**
+ * @return A parser that consumes (and returns) the rest of the line
+ */
+ full_line = parser txt=((!eol .)*) eol? -> Text.to_string(txt)
+
+ /**
* A parser combinator that succeed without consuming any input
* when given [{true}], or fails when given false
*/

0 comments on commit 5b614b7

Please sign in to comment.