Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
84b4784f
Kaydet (Commit)
84b4784f
authored
Nis 23, 2019
tarafından
tyomitch
Kaydeden (comit)
Inada Naoki
Nis 23, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use `const` in graminit.c (GH-12713)
üst
fb8c7d53
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
grammar.h
Include/grammar.h
+5
-5
grammar.py
Parser/pgen/grammar.py
+3
-3
graminit.c
Python/graminit.c
+0
-0
No files found.
Include/grammar.h
Dosyayı görüntüle @
84b4784f
...
...
@@ -13,7 +13,7 @@ extern "C" {
typedef
struct
{
int
lb_type
;
c
har
*
lb_str
;
c
onst
char
*
lb_str
;
}
label
;
#define EMPTY 0
/* Label number 0 is by definition the empty label */
...
...
@@ -22,7 +22,7 @@ typedef struct {
typedef
struct
{
int
ll_nlabels
;
label
*
ll_label
;
const
label
*
ll_label
;
}
labellist
;
/* An arc from one state to another */
...
...
@@ -36,7 +36,7 @@ typedef struct {
typedef
struct
{
int
s_narcs
;
arc
*
s_arc
;
/* Array of arcs */
const
arc
*
s_arc
;
/* Array of arcs */
/* Optional accelerators */
int
s_lower
;
/* Lowest label index */
...
...
@@ -59,8 +59,8 @@ typedef struct {
typedef
struct
{
int
g_ndfas
;
dfa
*
g_dfa
;
/* Array of DFAs */
labellist
g_ll
;
const
dfa
*
g_dfa
;
/* Array of DFAs */
const
labellist
g_ll
;
int
g_start
;
/* Start symbol of the grammar */
int
g_accel
;
/* Set if accelerators present */
}
grammar
;
...
...
Parser/pgen/grammar.py
Dosyayı görüntüle @
84b4784f
...
...
@@ -76,7 +76,7 @@ class Grammar:
def
print_labels
(
self
,
writer
):
writer
(
"static label labels[{n_labels}] = {{
\n
"
.
format
(
n_labels
=
len
(
self
.
labels
))
"static
const
label labels[{n_labels}] = {{
\n
"
.
format
(
n_labels
=
len
(
self
.
labels
))
)
for
label
,
name
in
self
.
labels
:
label_name
=
'"{}"'
.
format
(
name
)
if
name
is
not
None
else
0
...
...
@@ -89,7 +89,7 @@ class Grammar:
def
print_dfas
(
self
,
writer
):
self
.
print_states
(
writer
)
writer
(
"static dfa dfas[{}] = {{
\n
"
.
format
(
len
(
self
.
dfas
)))
writer
(
"static
const
dfa dfas[{}] = {{
\n
"
.
format
(
len
(
self
.
dfas
)))
for
dfaindex
,
dfa_elem
in
enumerate
(
self
.
dfas
.
items
()):
symbol
,
(
dfa
,
first_sets
)
=
dfa_elem
writer
(
...
...
@@ -131,7 +131,7 @@ class Grammar:
for
stateindex
,
state
in
enumerate
(
states
):
narcs
=
len
(
state
)
write
(
"static arc arcs_{dfa_index}_{state_index}[{n_arcs}] = {{
\n
"
.
format
(
"static
const
arc arcs_{dfa_index}_{state_index}[{n_arcs}] = {{
\n
"
.
format
(
dfa_index
=
dfaindex
,
state_index
=
stateindex
,
n_arcs
=
narcs
)
)
...
...
Python/graminit.c
Dosyayı görüntüle @
84b4784f
This diff is collapsed.
Click to expand it.
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