Sha256: 521b992d4e2a4ce34f8f53d77f29a8d0691d56bef10ea726131b0a79f9bd1973

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 KB

Contents

# vim: ts=2 sw=2 et
# -*- coding: ascii-8bit -*-
require 'ircp/parser/message_node_classes'

module Ircp
  module Parser
    # RFC1459 based
    grammar Message
      rule message
        prefix:( ':' v:prefix space )? command params:params? crlf? <MessageNode>
      end

      rule prefix
        '' servername &space <ShortPrefixNode> /
        nick user:( '!' v:user )? host:( '@' v:host )? <LongPrefixNode>
      end

      rule command
        letter+ <CommandNode> /
        number 3..3 <NumericReplyNode>
      end

      rule params
        middles:( space v:middle )* trailing:( space ':' v:trailing )? <ParamsNode>
      end

      rule middle
        [^ :] [^ ]*
      end

      rule trailing
        .*
      end


      rule space
        [ ]+
      end

      rule nospace
        [^ ]
      end

      rule crlf
        [\x0D\x0A]
      end

      rule letter
        [a-zA-Z]
      end

      rule number
        [0-9]
      end


      rule servername
        '' host <ServerNameNode>
      end

      rule host
        [^ !@]+ <HostNode>
      end

      rule nick
        [^ !@]+ <NickNode>
      end

      rule user
        [^ !@]+ <UserNode>
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ircp-1.1.8 lib/ircp/parser/message.treetop
ircp-1.1.7 lib/ircp/parser/message.treetop
ircp-1.1.6 lib/ircp/parser/message.treetop
ircp-1.1.5 lib/ircp/parser/message.treetop
ircp-1.1.4 lib/ircp/parser/message.treetop
ircp-1.1.3 lib/ircp/parser/message.treetop
ircp-1.1.2 lib/ircp/parser/message.treetop
ircp-1.1.1 lib/ircp/parser/message.treetop
ircp-1.1.0 lib/ircp/parser/message.treetop
ircp-1.0.0 lib/ircp/parser/message.treetop
ircp-0.0.4 lib/ircp/parser/message.treetop
ircp-0.0.3 lib/ircp/parser/message.treetop
ircp-0.0.2 lib/ircp/parser/message.treetop
ircp-0.0.1 lib/ircp/parser/message.treetop