Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Denley Lam
hammer
Commits
52088473
Commit
52088473
authored
9 years ago
by
Sven M. Hallberg
Browse files
Options
Downloads
Patches
Plain Diff
cosmetic changes
parent
65dbcf56
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backends/lr.c
+1
-1
1 addition, 1 deletion
src/backends/lr.c
src/backends/lr0.c
+4
-4
4 additions, 4 deletions
src/backends/lr0.c
with
5 additions
and
5 deletions
src/backends/lr.c
+
1
−
1
View file @
52088473
...
...
@@ -163,7 +163,7 @@ HLRAction *h_reduce_action(HArena *arena, const HLRItem *item)
}
// adds 'new' to the branches of 'action'
// returns
a
'action' if it is already of type HLR_CONFLICT
// returns 'action' if it is already of type HLR_CONFLICT
// allocates a new HLRAction otherwise
HLRAction
*
h_lr_conflict
(
HArena
*
arena
,
HLRAction
*
action
,
HLRAction
*
new
)
{
...
...
This diff is collapsed.
Click to expand it.
src/backends/lr0.c
+
4
−
4
View file @
52088473
...
...
@@ -30,9 +30,9 @@ static void expand_to_closure(HCFGrammar *g, HHashSet *items)
HCFChoice
*
sym
=
item
->
rhs
[
item
->
mark
];
// symbol after mark
// if there is a non-terminal after the mark, follow it
// and add items corresponding to the productions of sym
// NB: unlike LLk, we do consider HCF_CHARSET a non-terminal here
if
(
sym
!=
NULL
&&
(
sym
->
type
==
HCF_CHOICE
||
sym
->
type
==
HCF_CHARSET
))
{
// add items corresponding to the productions of sym
if
(
sym
!=
NULL
)
{
if
(
sym
->
type
==
HCF_CHOICE
)
{
for
(
HCFSequence
**
p
=
sym
->
seq
;
*
p
;
p
++
)
{
HLRItem
*
it
=
h_lritem_new
(
arena
,
sym
,
(
*
p
)
->
items
,
0
);
...
...
@@ -41,7 +41,7 @@ static void expand_to_closure(HCFGrammar *g, HHashSet *items)
h_slist_push
(
work
,
it
);
}
}
}
else
{
//
HCF_CHARSET
}
else
if
(
sym
->
type
==
HCF_CHARSET
)
{
for
(
unsigned
int
i
=
0
;
i
<
256
;
i
++
)
{
if
(
charset_isset
(
sym
->
charset
,
i
))
{
// XXX allocate these single-character symbols statically somewhere
...
...
@@ -93,8 +93,8 @@ HLRDFA *h_lr0_dfa(HCFGrammar *g)
// compute closure
// if destination is a new state:
// add it to state set
// add transition to it
// add it to the work list
// add transition to it
while
(
!
h_slist_empty
(
work
))
{
size_t
state_idx
=
(
uintptr_t
)
h_slist_pop
(
work
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment