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
Hide 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[] = {
...
@@ -242,6 +242,7 @@ const static KEYWORD tokens[] = {
TOKDEF
(
negative_diagonal
),
TOKDEF
(
negative_diagonal
),
TOKDEF
(
net
),
TOKDEF
(
net
),
TOKDEF
(
net_number
),
TOKDEF
(
net_number
),
TOKDEF
(
net_out
),
TOKDEF
(
net_pin_changes
),
TOKDEF
(
net_pin_changes
),
TOKDEF
(
nets
),
TOKDEF
(
nets
),
TOKDEF
(
network
),
TOKDEF
(
network
),
...
@@ -673,52 +674,62 @@ L_read:
...
@@ -673,52 +674,62 @@ L_read:
}
}
curTok
=
T_QUOTE_DEF
;
curTok
=
T_QUOTE_DEF
;
goto
exit
;
}
}
else
if
(
*
cur
==
'('
)
if
(
*
cur
==
'('
)
{
{
curText
.
clear
();
curText
.
clear
();
curText
+=
*
cur
;
curText
+=
*
cur
;
curTok
=
T_LEFT
;
curTok
=
T_LEFT
;
head
=
cur
+
1
;
head
=
cur
+
1
;
goto
exit
;
}
}
else
if
(
*
cur
==
')'
)
if
(
*
cur
==
')'
)
{
{
curText
.
clear
();
curText
.
clear
();
curText
+=
*
cur
;
curText
+=
*
cur
;
curTok
=
T_RIGHT
;
curTok
=
T_RIGHT
;
head
=
cur
+
1
;
head
=
cur
+
1
;
goto
exit
;
}
}
/* get the dash out of a <pin_reference> which is embedded for example
/* get the dash out of a <pin_reference> which is embedded for example
like: U2-14 or "U2"-"14"
like: U2-14 or "U2"-"14"
This is detectable by a non-space immediately preceeding the dash.
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
;
head
=
cur
+
1
;
curText
.
clear
();
curText
.
clear
();
curText
+=
'-'
;
curText
+=
'-'
;
curTok
=
T_DASH
;
curTok
=
T_DASH
;
goto
exit
;
}
}
// handle T_NUMBER
// handle T_NUMBER
else
if
(
strchr
(
"+-.0123456789"
,
*
cur
)
)
if
(
strchr
(
"+-.0123456789"
,
*
cur
)
)
{
{
head
=
cur
+
1
;
head
=
cur
+
1
;
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
++
head
;
++
head
;
curText
.
clear
();
if
(
(
head
<
limit
&&
isspace
(
*
head
))
||
*
head
==
')'
||
*
head
==
'('
||
head
==
limit
)
curText
.
append
(
cur
,
head
);
{
curTok
=
T_NUMBER
;
curText
.
clear
();
curText
.
append
(
cur
,
head
);
curTok
=
T_NUMBER
;
goto
exit
;
}
// else it was something like +5V, reset head back
}
}
// a quoted string
// a quoted string
else
if
(
*
cur
==
stringDelimiter
)
if
(
*
cur
==
stringDelimiter
)
{
{
++
cur
;
// skip over the leading delimiter: ",', or $
++
cur
;
// skip over the leading delimiter: ",', or $
...
@@ -738,12 +749,12 @@ L_read:
...
@@ -738,12 +749,12 @@ L_read:
++
head
;
// skip over the trailing delimiter
++
head
;
// skip over the trailing delimiter
curTok
=
T_STRING
;
curTok
=
T_STRING
;
goto
exit
;
}
}
// a token we hope to find in the tokens[] array. If not, then
// a token we hope to find in the tokens[] array. If not, then
// call it a T_SYMBOL.
// call it a T_SYMBOL.
else
{
{
head
=
cur
+
1
;
head
=
cur
+
1
;
while
(
head
<
limit
&&
!
isspace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
while
(
head
<
limit
&&
!
isspace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
...
@@ -757,16 +768,8 @@ L_read:
...
@@ -757,16 +768,8 @@ L_read:
if
(
found
!=
-
1
)
if
(
found
!=
-
1
)
curTok
=
(
DSN_T
)
found
;
curTok
=
(
DSN_T
)
found
;
else
// unrecogized token
else
// unrecogized token, call it a symbol
{
curTok
=
T_SYMBOL
;
curTok
=
T_SYMBOL
;
/*
wxString errTxt( CONV_FROM_UTF8( curText.c_str() ) );
errTxt << wxT(" ") << _("is an unrecognized token");
ThrowIOError( errTxt, cur-start+1 );
*/
}
}
}
}
}
...
@@ -775,6 +778,8 @@ exit: // single point of exit
...
@@ -775,6 +778,8 @@ exit: // single point of exit
curOffset
=
cur
-
start
;
curOffset
=
cur
-
start
;
next
=
head
;
next
=
head
;
// printf("tok:\"%s\"\n", curText.c_str() );
return
curTok
;
return
curTok
;
}
}
...
...
pcbnew/dsn.h
View file @
998de50e
...
@@ -242,6 +242,7 @@ enum DSN_T {
...
@@ -242,6 +242,7 @@ enum DSN_T {
T_negative_diagonal
,
T_negative_diagonal
,
T_net
,
T_net
,
T_net_number
,
T_net_number
,
T_net_out
,
T_net_pin_changes
,
T_net_pin_changes
,
T_nets
,
T_nets
,
T_network
,
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