daml/docs/configs/static/pygments_daml_lexer.py
Digital Asset GmbH 05e691f558 open-sourcing daml
2019-04-04 09:33:38 +01:00

26 lines
721 B
Python

# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from pygments.lexers.haskell import HaskellLexer
from pygments.lexer import inherit
from pygments.token import *
class DAMLLexer(HaskellLexer):
name = 'DAML'
aliases = ['daml']
filenames = ['*.daml']
daml_reserved = ('template', 'with', 'controller', 'can', 'ensure', 'daml', 'observer', 'signatory', 'agreement', 'controller', 'nonconsuming', 'return', 'this')
tokens = {
'root': [
(r'\b(%s)(?!\')\b' % '|'.join(daml_reserved), Keyword.Reserved),
(r'\b(True|False)\b', Keyword.Constant),
inherit
]
}