Click here to Skip to main content
15,914,160 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help in matching inputted string to a regex pattern Pin
molesworth5-Aug-09 3:07
molesworth5-Aug-09 3:07 
GeneralRe: Help in matching inputted string to a regex pattern Pin
gamer11275-Aug-09 4:00
gamer11275-Aug-09 4:00 
GeneralRe: Help in matching inputted string to a regex pattern Pin
riced5-Aug-09 4:22
riced5-Aug-09 4:22 
GeneralRe: Help in matching inputted string to a regex pattern Pin
gamer11275-Aug-09 4:39
gamer11275-Aug-09 4:39 
GeneralRe: Help in matching inputted string to a regex pattern Pin
riced5-Aug-09 4:44
riced5-Aug-09 4:44 
QuestionSerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 1:46
Super Lloyd5-Aug-09 1:46 
AnswerRe: SerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 4:00
Super Lloyd5-Aug-09 4:00 
GeneralRe: SerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 5:27
Super Lloyd5-Aug-09 5:27 
A better Irony grammar yet

[Language("Type FullName", "1.0", "Generic type name")]
class TypeNameGrammar : Grammar
{
    public TypeNameGrammar()
        : base(true)
    {
        var typeName = new NonTerminal("TypeName");
        this.Root = typeName;

        var ident = new FreeTextToChars("identifier", ",[]` ");
        var aname = new FreeTextToChars("AssemblyName", "]");
        var number = new NumberLiteral("number", NumberFlags.IntOnly);

        var optionalGenericType = new NonTerminal("GenericPart");
        var optionalAssembly = new NonTerminal("Assembly");
        var typeParameters = new NonTerminal("TypeParameters");

        typeName.Rule = ident + optionalGenericType + optionalAssembly;
        optionalGenericType.Rule =
            Empty
            | Symbol("`") + number + "[" + typeParameters + "]";
        optionalAssembly.Rule =
            Empty
            | Symbol(",") + aname;
        typeParameters.Rule =
            typeParameters + "," + "[" + typeName + "]"
            | Symbol("[") + typeName + "]";

        this.RegisterPunctuation("[", "]", "`", ",");
    }

    class FreeTextToChars : Terminal
    {
        private char[] stopChars;

        public FreeTextToChars(string name, string chars)
            : base(name, TokenCategory.Literal)
        {
            stopChars = chars.ToCharArray();
        }

        public override Token TryMatch(CompilerContext context, ISourceStream source)
        {
            var next = source.Text.IndexOfAny(stopChars, source.PreviewPosition);
            if (next == -1)
            {
                string token = source.Text.Substring(source.PreviewPosition);
                source.PreviewPosition = source.Text.Length;
                return source.CreateToken(this, token);
            }
            else
            {
                string token = source.Text.Substring(source.PreviewPosition, next - source.PreviewPosition);
                source.PreviewPosition = next;
                return source.CreateToken(this, token);
            }
        }
    }
}


A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.

QuestionHow to test Web Methods with NUnit Pin
Phillip Donegan5-Aug-09 1:26
Phillip Donegan5-Aug-09 1:26 
Questionbyte array To text box is it possible? Pin
gwithey5-Aug-09 1:24
gwithey5-Aug-09 1:24 
AnswerRe: byte array To text box is it possible? Pin
musefan5-Aug-09 2:16
musefan5-Aug-09 2:16 
QuestionConvert String To Unix Timestamp Pin
iNutR5-Aug-09 0:27
iNutR5-Aug-09 0:27 
AnswerRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:31
protectorChristian Graus5-Aug-09 0:31 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:36
iNutR5-Aug-09 0:36 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:39
protectorChristian Graus5-Aug-09 0:39 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:41
iNutR5-Aug-09 0:41 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:47
protectorChristian Graus5-Aug-09 0:47 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:54
iNutR5-Aug-09 0:54 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 1:00
protectorChristian Graus5-Aug-09 1:00 
GeneralRe: Convert String To Unix Timestamp Pin
Michael Bookatz5-Aug-09 2:35
Michael Bookatz5-Aug-09 2:35 
GeneralRe: Convert String To Unix Timestamp Pin
stancrm5-Aug-09 0:52
stancrm5-Aug-09 0:52 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:57
iNutR5-Aug-09 0:57 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 1:01
protectorChristian Graus5-Aug-09 1:01 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 1:47
iNutR5-Aug-09 1:47 
GeneralRe: Convert String To Unix Timestamp Pin
Michael Bookatz5-Aug-09 2:36
Michael Bookatz5-Aug-09 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.