-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from slowli/new-lecture
лекция 12
- Loading branch information
Showing
13 changed files
with
710 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
expression ::= element | list | ||
element ::= number | variable | ||
number ::= [+-]?['0'-'9']+ | ||
variable ::= ['A'-'Z''a'-z']'\w'* | ||
list ::= '[' (expression',')*expression ']' | '[]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function Button() { /*...*/ }; | ||
|
||
Button.prototype = { | ||
onClick: function() { /*...*/ }, | ||
onDoubleClick: function() { /*...*/ }, | ||
/* ... */ | ||
|
||
/** #Заменяет все методы объекта, начинающиеся на 'on', на заглушки.# */ | ||
disable4ever: function() { | ||
var noop = function() { alert('I am disabled!'); }; | ||
for (var member in this) { | ||
if ((typeof(this[member]) == 'function') | ||
&& (member.substring(0, 2) == 'on')) { | ||
this[member] = noop; | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* #Некорректный синтаксис# */ | ||
int x == 5; | ||
|
||
/* #Некорректная семантика — неизвестный тип переменной# */ | ||
MissingType y; | ||
|
||
/* #Некорректная семантика — переменная не определена# */ | ||
z = 3; | ||
|
||
/* #Некорректная семантика — переменная не инициализирована# */ | ||
String str; | ||
while (str.length() < 20) str += " "; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
printf("%s\n", "4" + 2); | ||
char* nextStr = "next string"; | ||
// выведет (скорее всего) "next string" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
String str = "4" + 2; // str == "42" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
$number = 2; | ||
$x = '4' + $number; // \$x == 6 | ||
$x = '4'.$number; // \$x == "42" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
x = "4" + 2; | ||
# TypeError: cannot concatenate 'str' and 'int' objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<table> | ||
<thead><tr><th>Author</th><th>Title</th></tr></thead> | ||
<tbody> | ||
{% for book in books %} | ||
<tr> | ||
<td>{{ book.author }}</td><td>{{ book.title }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Список книг, взятый из базы данных. | ||
books = [ | ||
{ 'author': 'Ray Bradbury', 'title': '451F' }, | ||
{ 'author': 'Herman Melville', 'title': 'Moby-Dick' } | ||
]; | ||
|
||
# HTML-код таблицы с данными о книгах. | ||
print '<table>'; | ||
print '<thead><tr><th>Author</th><th>Title</th></tr></thead>'; | ||
print '<tbody>'; | ||
for book in books: | ||
print '<tr><td>%s</td><td>%s</td></tr>' | ||
% (book['author'], book['title']); | ||
print '</tbody>'; | ||
print '</table>'; |
Oops, something went wrong.