private void matchPatterns (List<LexToken> tokens, List<LexPattern> ps, int start)
    {
        int end = source.length();
        if (start >= end)
        {
            return;
        }

        for (LexPattern p : ps)
        {
            int result = p.match(source, start, end);
            if (result > start && result < end)
            {
                LexType type = p.getTokenType();
                if (!type.isSkipped())
                {
                    tokens.add(new LexToken(type, this.source, start, result));
                }

                List<LexPattern> children = p.getChildren();
                if (children != null && children.size() > 0)
                {
                    matchPatterns(tokens, children, result);
                }
            }
            else
            {
                if (p.isOptional())
                    continue;
                else
                    break;
            }

        }

    }