Esempio n. 1
0
        public void OneLineComment()
        {
            var p = from v in Tok.OneLineComment(new HaskellDef())
                    select v;

            var res = p.Parse("-- This whole line is a comment");

            Assert.True(!res.IsFaulted);
        }
Esempio n. 2
0
        public WhiteSpace(LanguageDef def)
            :
            base(
                inp =>
        {
            var simpleSpace = Tok.SimpleSpace();

            if (String.IsNullOrEmpty(def.CommentLine) && String.IsNullOrEmpty(def.CommentStart))
            {
                return(Prim.SkipMany(
                           simpleSpace.Fail("")
                           ).Parse(inp));
            }
            else if (String.IsNullOrEmpty(def.CommentLine))
            {
                return(Prim.SkipMany <Unit>(
                           simpleSpace | Tok.MultiLineComment(def).Fail("")
                           ).Parse(inp));
            }
            else if (String.IsNullOrEmpty(def.CommentStart))
            {
                return(Prim.SkipMany <Unit>(
                           simpleSpace | Tok.OneLineComment(def).Fail("")
                           )
                       .Parse(inp));
            }
            else
            {
                return(Prim.SkipMany <Unit>(
                           simpleSpace | Tok.OneLineComment(def) | Tok.MultiLineComment(def).Fail("")
                           )
                       .Parse(inp));
            }
        }
                )
        { }