Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
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
kicad-source-mirror
Commits
998de50e
Commit
998de50e
authored
Jan 21, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lexer tweaks, more token definitions
parent
babc73e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
dsn.cpp
pcbnew/dsn.cpp
+25
-20
dsn.h
pcbnew/dsn.h
+1
-0
No files found.
pcbnew/dsn.cpp
View file @
998de50e
...
...
@@ -242,6 +242,7 @@ const static KEYWORD tokens[] = {
TOKDEF
(
negative_diagonal
),
TOKDEF
(
net
),
TOKDEF
(
net_number
),
TOKDEF
(
net_out
),
TOKDEF
(
net_pin_changes
),
TOKDEF
(
nets
),
TOKDEF
(
network
),
...
...
@@ -673,52 +674,62 @@ L_read:
}
curTok
=
T_QUOTE_DEF
;
goto
exit
;
}
else
if
(
*
cur
==
'('
)
if
(
*
cur
==
'('
)
{
curText
.
clear
();
curText
+=
*
cur
;
curTok
=
T_LEFT
;
head
=
cur
+
1
;
goto
exit
;
}
else
if
(
*
cur
==
')'
)
if
(
*
cur
==
')'
)
{
curText
.
clear
();
curText
+=
*
cur
;
curTok
=
T_RIGHT
;
head
=
cur
+
1
;
goto
exit
;
}
/* get the dash out of a <pin_reference> which is embedded for example
like: U2-14 or "U2"-"14"
This is detectable by a non-space immediately preceeding the dash.
*/
else
if
(
*
cur
==
'-'
&&
cur
>
start
&&
!
isspace
(
cur
[
-
1
]
)
)
if
(
*
cur
==
'-'
&&
cur
>
start
&&
!
isspace
(
cur
[
-
1
]
)
)
{
head
=
cur
+
1
;
curText
.
clear
();
curText
+=
'-'
;
curTok
=
T_DASH
;
goto
exit
;
}
// handle T_NUMBER
else
if
(
strchr
(
"+-.0123456789"
,
*
cur
)
)
if
(
strchr
(
"+-.0123456789"
,
*
cur
)
)
{
head
=
cur
+
1
;
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
++
head
;
if
(
(
head
<
limit
&&
isspace
(
*
head
))
||
*
head
==
')'
||
*
head
==
'('
||
head
==
limit
)
{
curText
.
clear
();
curText
.
append
(
cur
,
head
);
curTok
=
T_NUMBER
;
goto
exit
;
}
// else it was something like +5V, reset head back
}
// a quoted string
else
if
(
*
cur
==
stringDelimiter
)
if
(
*
cur
==
stringDelimiter
)
{
++
cur
;
// skip over the leading delimiter: ",', or $
...
...
@@ -739,11 +750,11 @@ L_read:
++
head
;
// skip over the trailing delimiter
curTok
=
T_STRING
;
goto
exit
;
}
// a token we hope to find in the tokens[] array. If not, then
// call it a T_SYMBOL.
else
{
head
=
cur
+
1
;
while
(
head
<
limit
&&
!
isspace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
...
...
@@ -757,16 +768,8 @@ L_read:
if
(
found
!=
-
1
)
curTok
=
(
DSN_T
)
found
;
else
// unrecogized token
{
else
// unrecogized token, call it a symbol
curTok
=
T_SYMBOL
;
/*
wxString errTxt( CONV_FROM_UTF8( curText.c_str() ) );
errTxt << wxT(" ") << _("is an unrecognized token");
ThrowIOError( errTxt, cur-start+1 );
*/
}
}
}
...
...
@@ -776,6 +779,8 @@ exit: // single point of exit
next
=
head
;
// printf("tok:\"%s\"\n", curText.c_str() );
return
curTok
;
}
...
...
pcbnew/dsn.h
View file @
998de50e
...
...
@@ -242,6 +242,7 @@ enum DSN_T {
T_negative_diagonal
,
T_net
,
T_net_number
,
T_net_out
,
T_net_pin_changes
,
T_nets
,
T_network
,
...
...
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