Superpower: match a string with parser only if it begins a line
问题 When parsing in superpower, how to match a string only if it is the first thing in a line? For example, I need to match the A colon in "A: Hello Goodbye\n" but not in "Goodbye A: Hello\n" 回答1: Using your example here, I would change your ActorParser and NodeParser definitions to this: public readonly static TokenListParser<Tokens, Node> ActorParser = from name in NameParser from colon in Token.EqualTo(Tokens.Colon) from text in TextParser select new Node { Actor = name + colon.ToStringValue()