diff --git a/Units/parser-meson.r/escape-in-string.d/args.ctags b/Units/parser-meson.r/escape-in-string.d/args.ctags new file mode 100644 index 0000000000..ac767da7bc --- /dev/null +++ b/Units/parser-meson.r/escape-in-string.d/args.ctags @@ -0,0 +1,3 @@ +--sort=no +--fields=+r +-G diff --git a/Units/parser-meson.r/escape-in-string.d/expected.tags b/Units/parser-meson.r/escape-in-string.d/expected.tags new file mode 100644 index 0000000000..76b7064574 --- /dev/null +++ b/Units/parser-meson.r/escape-in-string.d/expected.tags @@ -0,0 +1,6 @@ +v input.meson /^ v = get_option(tuple[0])$/;" V roles:def +v input.meson /^ v = run_command($/;" V roles:def +v input.meson /^ v = tuple[2]$/;" V roles:def +v input.meson /^ v = v.to_int()$/;" V roles:def +dynamic_uid_min input.meson /^dynamic_uid_min = get_option('dynamic-uid-min')$/;" V roles:def +v_eof input.meson /^v_eof=$/;" V roles:def diff --git a/Units/parser-meson.r/escape-in-string.d/input.meson b/Units/parser-meson.r/escape-in-string.d/input.meson new file mode 100644 index 0000000000..f17736a9c5 --- /dev/null +++ b/Units/parser-meson.r/escape-in-string.d/input.meson @@ -0,0 +1,31 @@ +# -*- Meson -*- +# Partially taken from meson.build in the source tree of systemd. +# +foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5). + ['system-uid-max', 'SYS_UID_MAX', 999], + ['system-alloc-gid-min', 'SYS_GID_MIN', 1], + ['system-gid-max', 'SYS_GID_MAX', 999]] + v = get_option(tuple[0]) + if v <= 0 + v = run_command( + awk, + '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]), + '/etc/login.defs', + check : false).stdout().strip() + if v == '' + v = tuple[2] + else + v = v.to_int() + endif + endif + conf.set(tuple[0].underscorify().to_upper(), v) +endforeach +if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX') + error('Invalid uid allocation range') +endif +if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX') + error('Invalid gid allocation range') +endif + +dynamic_uid_min = get_option('dynamic-uid-min') +v_eof= diff --git a/optlib/meson.c b/optlib/meson.c index 5b2c352196..583e608d32 100644 --- a/optlib/meson.c +++ b/optlib/meson.c @@ -59,8 +59,8 @@ static void initializeMesonParser (const langType language) "^test[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\1", "t", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "main", - "^([a-zA-Z_][a-zA-Z_0-9]*)[ \t\n]*=[ \t\n]*", - "\\1", "V", "", NULL); + "^([a-zA-Z_][a-zA-Z_0-9]*)[ \t\n]*=([^=]|$)", + "\\1", "V", "{_advanceTo=2start}", NULL); addLanguageTagMultiTableRegex (language, "main", "^.", "", "", "", NULL); @@ -74,14 +74,17 @@ static void initializeMesonParser (const langType language) "^.", "", "", "", NULL); addLanguageTagMultiTableRegex (language, "string", - "^\\\\'", + "^[^\\\\']+", "", "", "", NULL); addLanguageTagMultiTableRegex (language, "string", - "^[^\\\\']+", + "^\\\\.", "", "", "", NULL); addLanguageTagMultiTableRegex (language, "string", "^'", "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "string", + "^.", + "", "", "", NULL); addLanguageTagMultiTableRegex (language, "comment", "^[^\n]+", "", "", "", NULL); diff --git a/optlib/meson.ctags b/optlib/meson.ctags index 1445362110..9c7e117d37 100644 --- a/optlib/meson.ctags +++ b/optlib/meson.ctags @@ -50,9 +50,10 @@ --_mtable-regex-Meson=comment/[^\n]+// --_mtable-regex-Meson=comment/\n//{tleave} ---_mtable-regex-Meson=string/\\'// --_mtable-regex-Meson=string/[^\\']+// +--_mtable-regex-Meson=string/\\.// --_mtable-regex-Meson=string/'//{tleave} +--_mtable-regex-Meson=string/.// --_mtable-regex-Meson=mline_string/'''//{tleave} --_mtable-regex-Meson=mline_string/[^']+// @@ -79,5 +80,5 @@ --_mtable-regex-Meson=main/project[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/P/{tenter=skipToArgEnd} --_mtable-regex-Meson=main/subdir[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/S/{tenter=skipToArgEnd} --_mtable-regex-Meson=main/test[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/t/{tenter=skipToArgEnd} ---_mtable-regex-Meson=main/([a-zA-Z_][a-zA-Z_0-9]*)[ \t\n]*=[ \t\n]*/\1/V/ +--_mtable-regex-Meson=main/([a-zA-Z_][a-zA-Z_0-9]*)[ \t\n]*=([^=]|$)/\1/V/{_advanceTo=2start} --_mtable-regex-Meson=main/.//