"""
    wispy.grammar
    ~~~~~~~~~~~~~

    The grammar implementation of the *wispy* engine.
"""
# pylint: disable=missing-docstring, no-init, too-few-public-methods

from modgrammar import (
    Grammar, OR, WORD, REPEAT, ANY_EXCEPT,
    OPTIONAL, WHITESPACE,
)


class Newline(Grammar):
    grammar = OR("\n", "\r", "\r\n")


class InputCharacter(Grammar):
    grammar = ANY_EXCEPT("\r\n", max=1)


class InputCharacters(Grammar):
    grammar = REPEAT(InputCharacter)


class SingleLineComment(Grammar):
    grammar = ("#", OPTIONAL(WHITESPACE), OPTIONAL(InputCharacters))


class Keyword(Grammar):
    grammar = OR("begin", "break", "catch", "class",
                 "continue", "data", "define", "do",
                 "dynamicparam", "else", "elseif", "end",
                 "exit", "filter", "finally", "for",
                 "foreach", "from", "function", "if",
                 "in", "param", "process", "return",
                 "switch", "throw", "trap", "try",
                 "until", "using", "var", "while")


class HexadecimalDigit(Grammar):
    grammar = WORD('0-9a-fA-F', max=1)


class HexadecimalDigits(Grammar):
    grammar = REPEAT(HexadecimalDigit)


class LongTypeSuffix(Grammar):
    grammar = WORD("l", max=1)


class DecimalTypeSuffix(Grammar):
    grammar = WORD("d", max=1)


class NumericTypeSuffix(Grammar):
    grammar = OR(DecimalTypeSuffix, LongTypeSuffix)


class NumericMultiplier(Grammar):
    grammar = REPEAT(OR("kb", "mb", "tb", "pb", "gb"), max=1)


class HexadecimalIntegerLiteral(Grammar):
    grammar = ("0x", HexadecimalDigits,
               OPTIONAL(LongTypeSuffix),
               OPTIONAL(NumericMultiplier))


class DecimalDigit(Grammar):
    grammar = WORD('0-9', max=1)


class DecimalDigits(Grammar):
    grammar = REPEAT(DecimalDigit)


class DecimalIntegerLiteral(Grammar):
    grammar = (DecimalDigits,
               OPTIONAL(DecimalTypeSuffix),
               OPTIONAL(NumericMultiplier))

@@ -42,16 +42,27 @@
     The 
+Powershell 
 grammar 
@@ -99,16 +99,88 @@
 engine.%0A
+    The version used is PowerShell Language Specification Version 3.0.%0A%0A
 %22%22%22%0A# py
@@ -1110,154 +1110,115 @@
 %22)%0A%0A
-%0Aclass HexadecimalDigit(Grammar):%0A    grammar = WORD('0-9a-fA-F', max=1)%0A%0A%0Aclass HexadecimalDigits(Grammar):%0A    grammar = REPEAT(HexadecimalDigit
+# Literals%0A%0A%0Aclass NumericMultiplier(Grammar):%0A    grammar = REPEAT(OR(%22kb%22, %22mb%22, %22tb%22, %22pb%22, %22gb%22), max=1
 )%0A%0A%0A
@@ -1440,275 +1440,8 @@
 )%0A%0A%0A
-class NumericMultiplier(Grammar):%0A    grammar = REPEAT(OR(%22kb%22, %22mb%22, %22tb%22, %22pb%22, %22gb%22), max=1)%0A%0A%0Aclass HexadecimalIntegerLiteral(Grammar):%0A    grammar = (%220x%22, HexadecimalDigits,%0A               OPTIONAL(LongTypeSuffix),%0A               OPTIONAL(NumericMultiplier))%0A%0A%0A
 clas
@@ -1723,8 +1723,1063 @@
 plier))%0A
+%0A%0Aclass HexadecimalDigit(Grammar):%0A    grammar = WORD('0-9a-fA-F', max=1)%0A%0A%0Aclass HexadecimalDigits(Grammar):%0A    grammar = REPEAT(HexadecimalDigit)%0A%0A%0Aclass HexadecimalIntegerLiteral(Grammar):%0A    grammar = (%220x%22, HexadecimalDigits,%0A               OPTIONAL(LongTypeSuffix),%0A               OPTIONAL(NumericMultiplier))%0A%0A%0Aclass IntegerLiteral(Grammar):%0A    grammar = OR(DecimalIntegerLiteral, HexadecimalIntegerLiteral)%0A%0A%0Aclass Dash(Grammar):%0A    grammar = OR(%22-%22, %22%5Cu2013%22, %22%5Cu2014%22, %22%5Cu2015%22)%0A%0A%0Aclass Sign(Grammar):%0A    grammar = OR(%22+%22, Dash, max=1)%0A%0A%0Aclass ExponentPart(Grammar):%0A    grammar = (OR(%22e%22, %22E%22), OPTIONAL(Sign), DecimalDigits)%0A%0A%0Aclass RealLiteral(Grammar):%0A    grammar = OR(%0A        (DecimalDigits, %22.%22, DecimalDigits, OPTIONAL(ExponentPart),%0A         OPTIONAL(DecimalTypeSuffix), OPTIONAL(NumericMultiplier)),%0A%0A        (%22.%22, DecimalDigits, OPTIONAL(ExponentPart),%0A         OPTIONAL(DecimalTypeSuffix), OPTIONAL(NumericMultiplier)),%0A%0A        (DecimalDigits, ExponentPart, OPTIONAL(DecimalTypeSuffix),%0A         OPTIONAL(NumericMultiplier)))%0A

Rearrange the literal order and add new number literals in the grammar.