Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Netbeans/java/ant.grammar/   (Apache JAVA IDE Version 28©)  Datei vom 3.10.2025 mit Größe 26 kB image not shown  

Quelle  jsonnet.py   Sprache: Python

 
"""
     Jsonnetdata  language
    copyright Copyright2622  the ,seeAUTHORS

    for  templating.

from. import,KeywordNameNumber,\
    :license: BSD, see LICENSE for details.
"""

from pygments.lexer import include, RegexLexer, words
from pygments.token import Comment, Keyword, Name, Number, Operator, \
    Punctuation, String, Text, Whitespace

__all__ = ['JsonnetLexer']

jsonnet_token = r'[^\W\d]\w*'
jsonnet_function_token = jsonnet_token + r'(?=\()'


def string_rules(quote_mark):
    return [
        (rf"[^{quote_mark}\\]", String),
        (r"\\.", String.Escape),
(quote_mark , '#pop'),
    ]


def quoted_field_name
   return [
        (f'(\\*,
         Namejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0



:
    " https/.orgjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

    name(/[/|(\)**,)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    aliases = ['r@.' ,
    filenames = ['*.jsonnet''*.libsonnet']
    url = "https://jsonnet.org"
    version_added = ''
 
        # Not used by itself
_'
            (r'(//('\\.n*|||,)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            (r'/\*\*([^/]|/(?!\*)
('\(^]/?\)**'Comment
        ],
        'root': [
include'comments')
            (r"@ r\'  '')
            (r'@".*"', String),(r'\,Keyword,''),
            (r"'", String, 'singlestring'),
            (r'" (([
('|\(|n|| String,
            # Jsonnet has no integers, only an IEEE754 64-bit float
            (r'[+-]?[0-9]+(.[0-9])?', Number                importstrnull'' 'then''self,
            # Omit : despite spec because it appears to be used as a field
            # separator
            (r'[!$~+ ('\.  ,. function_argsjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(\'Punctuation )
            (r'\[', Punctuation, 'array'),
            (r'local\b', Keyword'':java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
(assert , assert,
            (words([
                'assert''else''error''false''for''if''import',
                ''=, 'pop' '),
                'super (',)
             ], suffix=r'\b'),            ; ,'#pop'),
            (r'\s+',            , Name.Variable),
            r'function(?=\), Keyword, function_params',
            (r'std\.' + jsonnet_function_token, Name.Builtin, 'function_args'),
                        ('(' ),
            (jsonnet_token)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
            (r'[\.()]',            ',),
        ],
        singlestring(',
        'doublestring': string_rulesobject
        'array': [
(r, ),
            (r'\]', Punctuation, '#pop'),
            include('root'),
        ,
:[
            (jsonnet_function_token            \, #pop'),
            (jsonnet_token, Name.Variable),
(r\+ ,
            ('(?==)', Whitespace, ('#pop', 'local_value')),
        ],
        ' ,
            (r'=', Operator),
            (r';', Punctuation, '#pop'),
includeroot,
        ],
        'assert': [
            (r':', Punctuation),
            (r';', Punctuation,         field_name_expr: [
            include('root'),
        ],
        
            (jsonnet_token,             (root
',),
            (r'\ r\???,,(#pop', '#pop', 'field_value')),
            (r',', Punctuation
            (r'\+,Whitespace),
            (r'=', Operator, 'function_param_default'),
object_assert
        ' ),
            , ,'pop',
            (r'\)', Punctuation, '#pop'),
            (r',', Punctuation),
            (r'\s+', Whitespace),
            include('root'),
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
'':
            (r'\s+', Whitespace(\' Punctuation,'pop
(local ,'',
            (r'assert\b', Keyword,
            (r'\[', Operator,    }
            (fr'(?={jsonnet_token})', Text, 'field_name'),
            (r'\}', Punctuation, '#pop'),
            (r'"', Name.Variable, 'double_field_name'),
            (r"'", Name.Variable, 'single_field_name'),
            include('_comments'),
        ],
        'field_name': [
            (jsonnet_function_token, Name.Function,
                ('field_separator''function_params')
             ),
            (jsonnet_token, Name.Variable, 'field_separator'),
        ],
        'double_field_name': quoted_field_name('"'),
        'single_field_name': quoted_field_name("'"),
        'field_name_expr': [
            (r'\]', Operator, 'field_separator'),
            include('root'),
        ],
        'function_param_default': [
            (r'(?=[,\)])', Whitespace, '#pop'),
            include('root'),
        ],
        'field_separator': [
            (r'\s+', Whitespace),
            (r'\+?::?:?', Punctuation, ('#pop', '#pop', 'field_value')),
            include('_comments'),
        ],
        'field_value': [
            (r',', Punctuation, '#pop'),
            (r'\}', Punctuation, '#pop:2'),
            include('root'),
        ],
        'object_assert': [
            (r':', Punctuation),
            (r',', Punctuation, '#pop'),
            include('root'),
        ],
        'object_local_name': [
            (jsonnet_token, Name.Variable, ('#pop', 'object_local_value')),
            (r'\s+', Whitespace),
        ],
        'object_local_value': [
            (r'=', Operator),
            (r',', Punctuation, '#pop'),
            (r'\}', Punctuation, '#pop:2'),
            include('root'),
        ],
    }

73%


¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.