Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
G
geany
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
geany
Commits
73be5c64
Kaydet (Commit)
73be5c64
authored
Eki 12, 2016
tarafından
Jiří Techet
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lregex: add new flag processing
For 'b', 'e', 'i' keep the corresponding GRegex flags.
üst
56936a86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
16 deletions
+104
-16
lregex.c
ctags/main/lregex.c
+104
-16
No files found.
ctags/main/lregex.c
Dosyayı görüntüle @
73be5c64
...
...
@@ -248,6 +248,55 @@ static bool parseTagRegex (
}
static
void
pre_ptrn_flag_exclusive_short
(
char
c
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
bool
*
exclusive
=
data
;
*
exclusive
=
true
;
}
static
void
pre_ptrn_flag_exclusive_long
(
const
char
*
const
s
CTAGS_ATTR_UNUSED
,
const
char
*
const
unused
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
pre_ptrn_flag_exclusive_short
(
'x'
,
data
);
}
static
flagDefinition
prePtrnFlagDef
[]
=
{
{
'x'
,
"exclusive"
,
pre_ptrn_flag_exclusive_short
,
pre_ptrn_flag_exclusive_long
,
NULL
,
"skip testing the other patterns if a line is matched to this pattern"
},
};
static
void
scope_ptrn_flag_eval
(
const
char
*
const
f
CTAGS_ATTR_UNUSED
,
const
char
*
const
v
,
void
*
data
)
{
unsigned
long
*
bfields
=
data
;
if
(
strcmp
(
v
,
"ref"
)
==
0
)
*
bfields
|=
SCOPE_REF
;
else
if
(
strcmp
(
v
,
"push"
)
==
0
)
*
bfields
|=
(
SCOPE_PUSH
|
SCOPE_REF
);
else
if
(
strcmp
(
v
,
"pop"
)
==
0
)
*
bfields
|=
SCOPE_POP
;
else
if
(
strcmp
(
v
,
"clear"
)
==
0
)
*
bfields
|=
SCOPE_CLEAR
;
else
if
(
strcmp
(
v
,
"set"
)
==
0
)
*
bfields
|=
(
SCOPE_CLEAR
|
SCOPE_PUSH
);
else
error
(
FATAL
,
"Unexpected value for scope flag in regex definition: scope=%s"
,
v
);
}
static
void
placeholder_ptrn_flag_eval
(
const
char
*
const
f
CTAGS_ATTR_UNUSED
,
const
char
*
const
v
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
unsigned
long
*
bfields
=
data
;
*
bfields
|=
SCOPE_PLACEHOLDER
;
}
static
flagDefinition
scopePtrnFlagDef
[]
=
{
{
'\0'
,
"scope"
,
NULL
,
scope_ptrn_flag_eval
,
"ACTION"
,
"use scope stack: ACTION = ref|push|pop|clear|set"
},
{
'\0'
,
"placeholder"
,
NULL
,
placeholder_ptrn_flag_eval
,
NULL
,
"don't put this tag to tags file."
},
};
static
kindOption
*
kindNew
()
{
kindOption
*
kind
=
xCalloc
(
1
,
kindOption
);
...
...
@@ -338,6 +387,8 @@ static regexPattern *addCompiledTagPattern (const langType language, GRegex* con
bool
exclusive
=
false
;
unsigned
long
scopeActions
=
0UL
;
flagsEval
(
flags
,
prePtrnFlagDef
,
ARRAY_SIZE
(
prePtrnFlagDef
),
&
exclusive
);
flagsEval
(
flags
,
scopePtrnFlagDef
,
ARRAY_SIZE
(
scopePtrnFlagDef
),
&
scopeActions
);
if
(
*
name
==
'\0'
&&
exclusive
&&
kind
==
KIND_REGEX_DEFAULT
)
{
kind
=
KIND_GHOST
;
...
...
@@ -376,6 +427,7 @@ static void addCompiledCallbackPattern (const langType language, GRegex* const p
{
regexPattern
*
ptrn
;
bool
exclusive
=
false
;
flagsEval
(
flags
,
prePtrnFlagDef
,
ARRAY_SIZE
(
prePtrnFlagDef
),
&
exclusive
);
ptrn
=
addCompiledTagCommon
(
language
,
pattern
,
'\0'
);
ptrn
->
type
=
PTRN_CALLBACK
;
ptrn
->
u
.
callback
.
function
=
callback
;
...
...
@@ -384,27 +436,63 @@ static void addCompiledCallbackPattern (const langType language, GRegex* const p
ptrn
->
disabled
=
disabled
;
}
static
void
regex_flag_basic_short
(
char
c
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
g_warning
(
"CTags 'b' flag not supported by Geany!"
);
}
static
void
regex_flag_basic_long
(
const
char
*
const
s
CTAGS_ATTR_UNUSED
,
const
char
*
const
unused
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
regex_flag_basic_short
(
'b'
,
data
);
}
static
void
regex_flag_extend_short
(
char
c
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
}
static
void
regex_flag_extend_long
(
const
char
*
const
c
CTAGS_ATTR_UNUSED
,
const
char
*
const
unused
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
regex_flag_extend_short
(
'e'
,
data
);
}
static
void
regex_flag_icase_short
(
char
c
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
int
*
cflags
=
data
;
*
cflags
|=
G_REGEX_CASELESS
;
}
static
void
regex_flag_icase_long
(
const
char
*
s
CTAGS_ATTR_UNUSED
,
const
char
*
const
unused
CTAGS_ATTR_UNUSED
,
void
*
data
)
{
regex_flag_icase_short
(
'i'
,
data
);
}
static
flagDefinition
regexFlagDefs
[]
=
{
{
'b'
,
"basic"
,
regex_flag_basic_short
,
regex_flag_basic_long
,
NULL
,
"interpreted as a Posix basic regular expression."
},
{
'e'
,
"extend"
,
regex_flag_extend_short
,
regex_flag_extend_long
,
NULL
,
"interpreted as a Posix extended regular expression (default)"
},
{
'i'
,
"icase"
,
regex_flag_icase_short
,
regex_flag_icase_long
,
NULL
,
"applied in a case-insensitive manner"
},
};
static
GRegex
*
compileRegex
(
const
char
*
const
regexp
,
const
char
*
const
flags
)
{
int
cflags
=
G_REGEX_MULTILINE
;
GRegex
*
result
=
NULL
;
GError
*
error
=
NULL
;
int
i
;
for
(
i
=
0
;
flags
!=
NULL
&&
flags
[
i
]
!=
'\0'
;
++
i
)
{
switch
((
int
)
flags
[
i
])
{
case
'b'
:
g_warning
(
"CTags 'b' flag not supported by Geany!"
);
break
;
case
'e'
:
break
;
case
'i'
:
cflags
|=
G_REGEX_CASELESS
;
break
;
default:
printf
(
"regex: unknown regex flag: '%c'
\n
"
,
*
flags
);
break
;
}
}
result
=
g_regex_new
(
regexp
,
cflags
,
0
,
&
error
);
if
(
error
)
GError
*
err
=
NULL
;
flagsEval
(
flags
,
regexFlagDefs
,
ARRAY_SIZE
(
regexFlagDefs
),
&
cflags
);
result
=
g_regex_new
(
regexp
,
cflags
,
0
,
&
err
);
if
(
err
)
{
printf
(
"regex: regcomp %s: %s
\n
"
,
regexp
,
erro
r
->
message
);
g_error_free
(
err
or
);
error
(
WARNING
,
"regcomp %s: %s"
,
regexp
,
er
r
->
message
);
g_error_free
(
err
);
}
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment