Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
e61fc3cb
Commit
e61fc3cb
authored
Aug 03, 2013
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 704172 - Nested Aliases fail when the nested alias has two or more arguments.
parent
f90a787e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
util.cpp
src/util.cpp
+44
-2
No files found.
src/util.cpp
View file @
e61fc3cb
...
@@ -6973,6 +6973,34 @@ struct Marker
...
@@ -6973,6 +6973,34 @@ struct Marker
int
size
;
// size of the marker
int
size
;
// size of the marker
};
};
/** For a string \a s that starts with a command name, returns the character
* offset within that string representing the first character after the
* command. For an alias with argument, this is the offset to the
* character just after the argument list.
*
* Examples:
* - s=="a b" returns 1
* - s=="a{2,3} b" returns 6
* = s=="#" returns 0
*/
static
int
findEndOfCommand
(
const
char
*
s
)
{
const
char
*
p
=
s
;
char
c
;
int
i
=
0
;
if
(
p
)
{
while
((
c
=*
p
)
&&
isId
(
c
))
p
++
;
if
(
c
==
'{'
)
{
QCString
args
=
extractAliasArgs
(
p
,
0
);
i
+=
args
.
length
();
}
i
+=
p
-
s
;
}
return
i
;
}
/** Replaces the markers in an alias definition \a aliasValue
/** Replaces the markers in an alias definition \a aliasValue
* with the corresponding values found in the comma separated argument
* with the corresponding values found in the comma separated argument
* list \a argList and the returns the result after recursive alias expansion.
* list \a argList and the returns the result after recursive alias expansion.
...
@@ -6988,11 +7016,17 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString
...
@@ -6988,11 +7016,17 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString
int
s
=
0
;
int
s
=
0
;
for
(
i
=
0
;
i
<
l
;
i
++
)
for
(
i
=
0
;
i
<
l
;
i
++
)
{
{
if
(
argList
.
at
(
i
)
==
','
&&
(
i
==
0
||
argList
.
at
(
i
-
1
)
!=
'\\'
))
char
c
=
argList
.
at
(
i
);
if
(
c
==
','
&&
(
i
==
0
||
argList
.
at
(
i
-
1
)
!=
'\\'
))
{
{
args
.
append
(
new
QCString
(
argList
.
mid
(
s
,
i
-
s
)));
args
.
append
(
new
QCString
(
argList
.
mid
(
s
,
i
-
s
)));
s
=
i
+
1
;
// start of next argument
s
=
i
+
1
;
// start of next argument
}
}
else
if
(
c
==
'@'
||
c
==
'\\'
)
{
// check if this is the start of another aliased command (see bug704172)
i
+=
findEndOfCommand
(
argList
.
data
()
+
i
+
1
);
}
}
}
if
(
l
>
s
)
args
.
append
(
new
QCString
(
argList
.
right
(
l
-
s
)));
if
(
l
>
s
)
args
.
append
(
new
QCString
(
argList
.
right
(
l
-
s
)));
//printf("found %d arguments\n",args.count());
//printf("found %d arguments\n",args.count());
...
@@ -7152,6 +7186,7 @@ static QCString expandAliasRec(const QCString s)
...
@@ -7152,6 +7186,7 @@ static QCString expandAliasRec(const QCString s)
return
result
;
return
result
;
}
}
int
countAliasArguments
(
const
QCString
argList
)
int
countAliasArguments
(
const
QCString
argList
)
{
{
int
count
=
1
;
int
count
=
1
;
...
@@ -7159,8 +7194,15 @@ int countAliasArguments(const QCString argList)
...
@@ -7159,8 +7194,15 @@ int countAliasArguments(const QCString argList)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
l
;
i
++
)
for
(
i
=
0
;
i
<
l
;
i
++
)
{
{
if
(
argList
.
at
(
i
)
==
','
&&
(
i
==
0
||
argList
.
at
(
i
-
1
)
!=
'\\'
))
count
++
;
char
c
=
argList
.
at
(
i
);
if
(
c
==
','
&&
(
i
==
0
||
argList
.
at
(
i
-
1
)
!=
'\\'
))
count
++
;
else
if
(
c
==
'@'
||
c
==
'\\'
)
{
// check if this is the start of another aliased command (see bug704172)
i
+=
findEndOfCommand
(
argList
.
data
()
+
i
+
1
);
}
}
}
//printf("countAliasArguments=%d\n",count);
return
count
;
return
count
;
}
}
...
...
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