Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
bf1e56ec
Commit
bf1e56ec
authored
Nov 01, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another attempt
parent
040b4e4f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
include/cif++/parser.hpp
+1
-1
src/parser.cpp
+8
-5
No files found.
include/cif++/parser.hpp
View file @
bf1e56ec
...
@@ -257,7 +257,7 @@ class sac_parser
...
@@ -257,7 +257,7 @@ class sac_parser
CIFToken
m_lookahead
;
CIFToken
m_lookahead
;
std
::
string
m_token_value
;
std
::
string
m_token_value
;
CIFValue
mTokenType
;
CIFValue
mTokenType
;
std
::
string
m_buffer
;
// retract buffer, used to be a stack<char>
std
::
vector
<
int
>
m_buffer
;
// retract buffer, used to be a stack<char>
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
...
src/parser.cpp
View file @
bf1e56ec
...
@@ -64,13 +64,13 @@ int sac_parser::get_next_char()
...
@@ -64,13 +64,13 @@ int sac_parser::get_next_char()
{
{
int
result
=
std
::
char_traits
<
char
>::
eof
();
int
result
=
std
::
char_traits
<
char
>::
eof
();
if
(
not
m_buffer
.
empty
())
if
(
m_buffer
.
empty
())
result
=
m_source
.
sbumpc
();
else
{
{
result
=
m_buffer
.
back
();
result
=
m_buffer
.
back
();
m_buffer
.
pop_back
();
m_buffer
.
pop_back
();
}
}
else
result
=
m_source
.
sbumpc
();
// very simple CR/LF translation into LF
// very simple CR/LF translation into LF
if
(
result
==
'\r'
)
if
(
result
==
'\r'
)
...
@@ -81,7 +81,10 @@ int sac_parser::get_next_char()
...
@@ -81,7 +81,10 @@ int sac_parser::get_next_char()
result
=
'\n'
;
result
=
'\n'
;
}
}
m_token_value
.
push_back
(
static_cast
<
char
>
(
result
));
if
(
result
==
std
::
char_traits
<
char
>::
eof
())
m_token_value
.
push_back
(
0
);
else
m_token_value
.
push_back
(
std
::
char_traits
<
char
>::
to_char_type
(
result
));
if
(
result
==
'\n'
)
if
(
result
==
'\n'
)
++
m_line_nr
;
++
m_line_nr
;
...
@@ -106,7 +109,7 @@ void sac_parser::retract()
...
@@ -106,7 +109,7 @@ void sac_parser::retract()
if
(
ch
==
'\n'
)
if
(
ch
==
'\n'
)
--
m_line_nr
;
--
m_line_nr
;
m_buffer
.
push_back
(
ch
);
m_buffer
.
push_back
(
ch
==
0
?
std
::
char_traits
<
char
>::
eof
()
:
std
::
char_traits
<
char
>::
to_int_type
(
ch
)
);
m_token_value
.
pop_back
();
m_token_value
.
pop_back
();
}
}
...
...
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