7:3
     """
    pygments.lexers.forth
    ~~~~~~~~~~~~~~~~~~~~~

    Lexer for the Forth language.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re

from pygments.lexer import RegexLexer, bygroups
from pygments.token import Text, Comment, Keyword, Name, String, Number, \
    Whitespace


__all__ = ['ForthLexer']


class ForthLexer(RegexLexer):
    """
    Lexer for Forth files.

    .. versionadded:: 2.2
    """
    name = 'Forth'
    url = 'https://www.forth.com/forth/'
    aliases = ['forth']
    filenames = ['*.frt', '*.fs']
    mimetypes = ['application/x-forth']

    flags = re.IGNORECASE | re.MULTILINE

    tokens = {
        'root': [
            (r'\s+', Whitespace),
            # All comment types
            (r'\\.*?$', Comment.Single),
            (r'\([\s].*?\)', Comment.Single),
            # defining words. The next word is a new command name
            (r'(:|variable|constant|value|buffer:)(\s+)',
             bygroups(Keyword.Namespace, Whitespace), 'worddef'),
            # strings are rather simple
            (r'([.sc]")(\s+?)', bygroups(String, Whitespace), 'stringdef'),
            # keywords from the various wordsets
            # *** Wordset BLOCK
            (r'(blk|block|buffer|evaluate|flush|load|save-buffers|update|'
             # *** Wordset BLOCK-EXT
             r'empty-buffers|list|refill|scr|thru|'
             # *** Wordset CORE
             r'\#s|\*\/mod|\+loop|\/mod|0<|0=|1\+|1-|2!|'
             r'2\*|2\/|2@|2drop|2dup|2over|2swap|>body|'
             r'>in|>number|>r|\?dup|abort|abort\"|abs|'
             r'accept|align|aligned|allot|and|base|begin|'
             r'bl|c!|c,|c@|cell\+|cells|char|char\+|'
             r'chars|constant|count|cr|create|decimal|'
             r'depth|do|does>|drop|dup|else|emit|environment\?|'
             r'evaluate|execute|exit|fill|find|fm\/mod|'
             r'here|hold|i|if|immediate|invert|j|key|'
             r'leave|literal|loop|lshift|m\*|max|min|'
             r'mod|move|negate|or|over|postpone|quit|'
             r'r>|r@|recurse|repeat|rot|rshift|s\"|s>d|'
             r'sign|sm\/rem|source|space|spaces|state|swap|'
             r'then|type|u\.|u\<|um\*|um\/mod|unloop|until|'
             r'variable|while|word|xor|\[char\]|\[\'\]|'
             r'@|!|\#|<\#|\#>|:|;|\+|-|\*|\/|,|<|>|\|1\+|1-|\.|'
             # *** Wordset CORE-EXT
             r'\.r|0<>|'
             r'0>|2>r|2r>|2r@|:noname|\?do|again|c\"|'
             r'case|compile,|endcase|endof|erase|false|'
             r'hex|marker|nip|of|pad|parse|pick|refill|'
             r'restore-input|roll|save-input|source-id|to|'
             r'true|tuck|u\.r|u>|unused|value|within|'
             r'\[compile\]|'
             # *** Wordset CORE-EXT-obsolescent
             r'\#tib|convert|expect|query|span|'
             r'tib|'
             # *** Wordset DOUBLE
             r'2constant|2literal|2variable|d\+|d-|'
             r'd\.|d\.r|d0<|d0=|d2\*|d2\/|d<|d=|d>s|'
             r'dabs|dmax|dmin|dnegate|m\*\/|m\+|'
             # *** Wordset DOUBLE-EXT
             r'2rot|du<|'
             # *** Wordset EXCEPTION
             r'catch|throw|'
             # *** Wordset EXCEPTION-EXT
             r'abort|abort\"|'
             # *** Wordset FACILITY
             r'at-xy|key\?|page|'
             # *** Wordset FACILITY-EXT
             r'ekey|ekey>char|ekey\?|emit\?|ms|time&date|'
             # *** Wordset FILE
             r'BIN|CLOSE-FILE|CREATE-FILE|DELETE-FILE|FILE-POSITION|'
             r'FILE-SIZE|INCLUDE-FILE|INCLUDED|OPEN-FILE|R\/O|'
             r'R\/W|READ-FILE|READ-LINE|REPOSITION-FILE|RESIZE-FILE|'
             r'S\"|SOURCE-ID|W/O|WRITE-FILE|WRITE-LINE|'
             # *** Wordset FILE-EXT
             r'FILE-STATUS|FLUSH-FILE|REFILL|RENAME-FILE|'
             # *** Wordset FLOAT
             r'>float|d>f|'
             r'f!|f\*|f\+|f-|f\/|f0<|f0=|f<|f>d|f@|'
             r'falign|faligned|fconstant|fdepth|fdrop|fdup|'
             r'fliteral|float\+|floats|floor|fmax|fmin|'
             r'fnegat