Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http, ini, pgsql language broken #21

Open
The28AWG opened this issue Mar 15, 2021 · 2 comments
Open

http, ini, pgsql language broken #21

The28AWG opened this issue Mar 15, 2021 · 2 comments

Comments

@The28AWG
Copy link

I found that the syntax I needed was not highlighted in any way. I decided to check the rest of the languages and found more recognition errors.

@The28AWG
Copy link
Author

If anyone is interested, here is the revised version for ini:

import 'package:highlight/src/common_modes.dart';
import 'package:highlight/src/mode.dart';

///
String either(List<String> args) => '(' + args.join('|') + ')';

///
String BARE_KEY = r'([A-Za-z0-9_-]+)(\s*\.\s*[A-Za-z0-9_-]+)*';

///
String QUOTED_KEY_DOUBLE_QUOTE = r'"("|[^"])*"';

///
String QUOTED_KEY_SINGLE_QUOTE = r"'[^']*'";

///
String ANY_KEY = either(
  [
    BARE_KEY,
    QUOTED_KEY_DOUBLE_QUOTE,
    QUOTED_KEY_SINGLE_QUOTE,
  ],
);

///
final ini = Mode(
  refs: {
    '~contains~2~starts~contains~1~contains~4': Mode(
      className: 'number',
      relevance: 0,
      variants: [
        Mode(
          begin: '([\\+\\-]+)?[\\d]+_[\\d_]+',
        ),
        Mode(
          begin: '\\b\\d+(\\.\\d+)?',
        )
      ],
    ),
    '~contains~2~starts~contains~1~contains~3': Mode(
      className: 'string',
      contains: [BACKSLASH_ESCAPE],
      variants: [
        Mode(
          begin: "'''",
          end: "'''",
          relevance: 10,
        ),
        Mode(
          begin: '\"\"\"',
          end: '\"\"\"',
          relevance: 10,
        ),
        Mode(
          begin: '\"',
          end: '\"',
        ),
        Mode(
          begin: "'",
          end: "'",
        ),
      ],
    ),
    '~contains~2~starts~contains~1~contains~2': Mode(
      className: 'variable',
      variants: [
        Mode(
          begin: '\\\$[\\w\\d\"][\\w\\d_]*',
        ),
        Mode(
          begin: '\\\$\\{(.*?)}',
        ),
      ],
    ),
    '~contains~2~starts~contains~1~contains~1': Mode(
      className: 'literal',
      begin: '\\bon|off|true|false|yes|no\\b',
    ),
    '~contains~0': Mode(
      className: 'comment',
      contains: [
        PHRASAL_WORDS_MODE,
        Mode(
          className: 'doctag',
          begin: '(?:TODO|FIXME|NOTE|BUG|XXX):',
          relevance: 0,
        )
      ],
      variants: [
        Mode(
          begin: ';',
          end: '\$',
        ),
        Mode(
          begin: '#',
          end: '\$',
        ),
      ],
    ),
  },
  aliases: ['toml'],
  case_insensitive: true,
  illegal: r'\S',
  contains: [
    Mode(
      ref: '~contains~0',
    ),
    Mode(
      className: 'section',
      begin: '\\[+',
      end: '\\]+',
    ),
    Mode(
      begin: ANY_KEY,
      className: 'attr',
      starts: Mode(
        end: '\$',
        contains: [
          Mode(
            ref: '~contains~0',
          ),
          Mode(
            begin: '\\[',
            end: '\\]',
            contains: [
              Mode(ref: '~contains~0'),
              Mode(
                ref: '~contains~2~starts~contains~1~contains~1',
              ),
              Mode(
                ref: '~contains~2~starts~contains~1~contains~2',
              ),
              Mode(
                ref: '~contains~2~starts~contains~1~contains~3',
              ),
              Mode(
                ref: '~contains~2~starts~contains~1~contains~4',
              ),
              Mode(
                self: true,
              )
            ],
            relevance: 0,
          ),
          Mode(
            ref: '~contains~2~starts~contains~1~contains~1',
          ),
          Mode(
            ref: '~contains~2~starts~contains~1~contains~2',
          ),
          Mode(
            ref: '~contains~2~starts~contains~1~contains~3',
          ),
          Mode(
            ref: '~contains~2~starts~contains~1~contains~4',
          ),
        ],
      ),
    ),
  ],
);

I did not make a pull request since the file is marked:
// GENERATED CODE - DO NOT MODIFY BY HAND

@godalming123
Copy link

Just using my app and noticed that the ini format is not working everything else is just looks like this needs implementing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants